Merge "mw.config: Add wgPageContentModel for content model of current page"
[lhc/web/wiklou.git] / tests / parser / parserTests.txt
1 # MediaWiki Parser test cases
2 # Some taken from http://meta.wikimedia.org/wiki/Parser_testing
3 # All (C) their respective authors and released under the GPL
4 #
5 # The syntax should be fairly self-explanatory.
6 #
7 # Currently supported test options:
8 # One of the following three:
9 #
10 # (default) generate HTML output
11 # pst apply pre-save transform
12 # msg apply message transform
13 #
14 # Plus any combination of these:
15 #
16 # cat add category links
17 # ill add inter-language links
18 # subpage enable subpages (disabled by default)
19 # noxml don't check for XML well formdness
20 # title=[[XXX]] run test using article title XXX
21 # language=XXX set content language to XXX for this test
22 # variant=XXX set the variant of language for this test (eg zh-tw)
23 # disabled do not run test
24 # parsoid parsoid-only test (not run by PHP parser)
25 # php php-only test (not run by the parsoid parser)
26 # showtitle make the first line the title
27 # comment run through Linker::formatComment() instead of main parser
28 # local format section links in edit comment text as local links
29 #
30 # For testing purposes, temporary articles can created:
31 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
32 # where '/' denotes a newline.
33
34 # This is the standard article assumed to exist.
35 !! article
36 Main Page
37 !! text
38 blah blah
39 !! endarticle
40
41 !!article
42 Template:Foo
43 !!text
44 FOO
45 !!endarticle
46
47 !! article
48 Template:Blank
49 !! text
50 !! endarticle
51
52 !! article
53 Template:pipe
54 !! text
55 |
56 !! endarticle
57
58 !!article
59 MediaWiki:bad image list
60 !!text
61 * [[File:Bad.jpg]] except [[Nasty page]]
62 !!endarticle
63
64 !! article
65 Template:inner list
66 !! text
67 * item 1
68 !! endarticle
69
70 !! article
71 Template:tbl-start
72 !! text
73 {|
74 !! endarticle
75
76 !! article
77 Template:tbl-end
78 !! text
79 |}
80 !! endarticle
81
82 !! article
83 Template:!
84 !! text
85 |
86 !! endarticle
87
88 !! article
89 Template:echo
90 !! text
91 {{{1}}}
92 !! endarticle
93
94 !! article
95 Template:echo_with_span
96 !! text
97 <span>{{{1}}}</span>
98 !! endarticle
99
100 !! article
101 Template:echo_with_div
102 !! text
103 <div>{{{1}}}</div>
104 !! endarticle
105
106 !! article
107 Template:attr_str
108 !! text
109 {{{1}}}="{{{2}}}"
110 !! endarticle
111
112 !! article
113 Template:table_attribs
114 !! text
115 <noinclude>
116 |</noinclude>style="color: red"| Foo
117 !! endarticle
118
119 !! article
120 A?b
121 !! text
122 Weirdo titles!
123 !! endarticle
124
125 ###
126 ### Basic tests
127 ###
128 !! test
129 Blank input
130 !! input
131 !! result
132 !! end
133
134
135 !! test
136 Simple paragraph
137 !! input
138 This is a simple paragraph.
139 !! result
140 <p>This is a simple paragraph.
141 </p>
142 !! end
143
144 !! test
145 Paragraphs with extra newline spacing
146 !! input
147 foo
148
149 bar
150
151
152 baz
153
154
155
156 booz
157 !! result
158 <p>foo
159 </p><p>bar
160 </p><p><br />
161 baz
162 </p><p><br />
163 </p><p>booz
164 </p>
165 !! end
166
167 !! test
168 Paragraphs with newline spacing with comment lines in between
169 !! input
170 ----
171 a
172 <!--foo-->
173 b
174 ----
175 a
176 <!--foo--><!--More than 1 comment disables stripping of this line!-->
177 b
178 ----
179 a
180 <!--foo-->
181
182 b
183 ----
184 a
185
186 <!--foo-->
187 b
188 ----
189 a
190 <!--foo-->
191
192
193 b
194 ----
195 a
196
197
198 <!--foo-->
199 b
200 ----
201 !! result
202 <hr />
203 <p>a
204 b
205 </p>
206 <hr />
207 <p>a
208 </p><p>b
209 </p>
210 <hr />
211 <p>a
212 </p><p>b
213 </p>
214 <hr />
215 <p>a
216 </p><p>b
217 </p>
218 <hr />
219 <p>a
220 </p><p><br />
221 b
222 </p>
223 <hr />
224 <p>a
225 </p><p><br />
226 b
227 </p>
228 <hr />
229
230 !! end
231
232 !! test
233 Paragraphs with newline spacing with non-empty white-space lines in between
234 !! input
235 ----
236 a
237
238 b
239 ----
240 a
241
242
243 b
244 ----
245 !! result
246 <hr />
247 <p>a
248 </p><p>b
249 </p>
250 <hr />
251 <p>a
252 </p><p><br />
253 b
254 </p>
255 <hr />
256
257 !! end
258
259 !! test
260 Paragraphs with newline spacing with non-empty mixed comment and white-space lines in between
261 !! input
262 ----
263 a
264 <!--foo-->
265 b
266 ----
267 a
268 <!--foo--><!--More than 1 comment disables stripping of this line!-->
269 b
270 ----
271 a
272
273 <!--foo-->
274 <!--bar-->
275 b
276 ----
277 a
278
279 <!--foo-->
280 <!--bar-->
281
282 b
283 ----
284 !! result
285 <hr />
286 <p>a
287 b
288 </p>
289 <hr />
290 <p>a
291 </p><p>b
292 </p>
293 <hr />
294 <p>a
295 </p><p>b
296 </p>
297 <hr />
298 <p>a
299 </p><p><br />
300 b
301 </p>
302 <hr />
303
304 !! end
305
306 !! test
307 Parsing an URL
308 !! input
309 http://fr.wikipedia.org/wiki/🍺
310 <!-- EasterEgg we love beer, better be able be able to link to it -->
311 !! result
312 <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
313 </p>
314 !! end
315
316 !! test
317 Simple list
318 !! input
319 * Item 1
320 * Item 2
321 !! result
322 <ul><li> Item 1
323 </li><li> Item 2
324 </li></ul>
325
326 !! end
327
328 !! test
329 Italics and bold
330 !! input
331 * plain
332 * plain''italic''plain
333 * plain''italic''plain''italic''plain
334 * plain'''bold'''plain
335 * plain'''bold'''plain'''bold'''plain
336 * plain''italic''plain'''bold'''plain
337 * plain'''bold'''plain''italic''plain
338 * plain''italic'''bold-italic'''italic''plain
339 * plain'''bold''bold-italic''bold'''plain
340 * plain'''''bold-italic'''italic''plain
341 * plain'''''bold-italic''bold'''plain
342 * plain''italic'''bold-italic'''''plain
343 * plain'''bold''bold-italic'''''plain
344 * plain l'''italic''plain
345 * plain l''''bold''' plain
346 !! result
347 <ul><li> plain
348 </li><li> plain<i>italic</i>plain
349 </li><li> plain<i>italic</i>plain<i>italic</i>plain
350 </li><li> plain<b>bold</b>plain
351 </li><li> plain<b>bold</b>plain<b>bold</b>plain
352 </li><li> plain<i>italic</i>plain<b>bold</b>plain
353 </li><li> plain<b>bold</b>plain<i>italic</i>plain
354 </li><li> plain<i>italic<b>bold-italic</b>italic</i>plain
355 </li><li> plain<b>bold<i>bold-italic</i>bold</b>plain
356 </li><li> plain<i><b>bold-italic</b>italic</i>plain
357 </li><li> plain<b><i>bold-italic</i>bold</b>plain
358 </li><li> plain<i>italic<b>bold-italic</b></i>plain
359 </li><li> plain<b>bold<i>bold-italic</i></b>plain
360 </li><li> plain l'<i>italic</i>plain
361 </li><li> plain l'<b>bold</b> plain
362 </li></ul>
363
364 !! end
365
366 # this example taken from the simple/Moon article
367 !! test
368 Italics and possessives
369 !! input
370 obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
371 !! result
372 <p>obtained by <i><a href="/index.php?title=Lunar_Prospector&amp;action=edit&amp;redlink=1" class="new" title="Lunar Prospector (page does not exist)">Lunar Prospector</a>'</i>s gamma-ray spectrometer
373 </p>
374 !! end
375
376 ###
377 ### 2-quote opening sequence tests
378 ###
379 !! test
380 Italics and bold: 2-quote opening sequence: (2,2)
381 !! input
382 ''foo''
383 !! result
384 <p><i>foo</i>
385 </p>
386 !!end
387
388
389 !! test
390 Italics and bold: 2-quote opening sequence: (2,3)
391 !! input
392 ''foo'''
393 !! result
394 <p><i>foo'</i>
395 </p>
396 !!end
397
398
399 !! test
400 Italics and bold: 2-quote opening sequence: (2,4)
401 !! input
402 ''foo''''
403 !! result
404 <p><i>foo''</i>
405 </p>
406 !!end
407
408
409 !! test
410 Italics and bold: 2-quote opening sequence: (2,5) (php)
411 !! options
412 php
413 !! input
414 ''foo'''''
415 !! result
416 <p><i>foo</i>
417 </p>
418 !!end
419 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
420 !! test
421 Italics and bold: 2-quote opening sequence: (2,5) (parsoid)
422 !! options
423 parsoid
424 !! input
425 ''foo'''''
426 !! result
427 <p><i>foo</i><b></b>
428 </p>
429 !!end
430
431
432 ###
433 ### 3-quote opening sequence tests
434 ###
435
436 !! test
437 Italics and bold: 3-quote opening sequence: (3,2)
438 !! input
439 '''foo''
440 !! result
441 <p>'<i>foo</i>
442 </p>
443 !!end
444
445
446 !! test
447 Italics and bold: 3-quote opening sequence: (3,3)
448 !! input
449 '''foo'''
450 !! result
451 <p><b>foo</b>
452 </p>
453 !!end
454
455
456 !! test
457 Italics and bold: 3-quote opening sequence: (3,4)
458 !! input
459 '''foo''''
460 !! result
461 <p><b>foo'</b>
462 </p>
463 !!end
464
465
466 !! test
467 Italics and bold: 3-quote opening sequence: (3,5) (php)
468 !! options
469 php
470 !! input
471 '''foo'''''
472 !! result
473 <p><b>foo</b>
474 </p>
475 !!end
476 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
477 !! test
478 Italics and bold: 3-quote opening sequence: (3,5) (parsoid)
479 !! options
480 parsoid
481 !! input
482 '''foo'''''
483 !! result
484 <p><b>foo<i></i></b>
485 </p>
486 !!end
487
488
489 ###
490 ### 4-quote opening sequence tests
491 ###
492
493 !! test
494 Italics and bold: 4-quote opening sequence: (4,2)
495 !! input
496 ''''foo''
497 !! result
498 <p>''<i>foo</i>
499 </p>
500 !!end
501
502
503 !! test
504 Italics and bold: 4-quote opening sequence: (4,3)
505 !! input
506 ''''foo'''
507 !! result
508 <p>'<b>foo</b>
509 </p>
510 !!end
511
512
513 !! test
514 Italics and bold: 4-quote opening sequence: (4,4)
515 !! input
516 ''''foo''''
517 !! result
518 <p>'<b>foo'</b>
519 </p>
520 !!end
521
522
523 !! test
524 Italics and bold: 4-quote opening sequence: (4,5) (php)
525 !! options
526 php
527 !! input
528 ''''foo'''''
529 !! result
530 <p>'<b>foo</b>
531 </p>
532 !!end
533 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
534 !! test
535 Italics and bold: 4-quote opening sequence: (4,5) (parsoid)
536 !! options
537 parsoid
538 !! input
539 ''''foo'''''
540 !! result
541 <p>'<b>foo<i></i></b>
542 </p>
543 !!end
544
545
546 ###
547 ### 5-quote opening sequence tests
548 ###
549
550 !! test
551 Italics and bold: 5-quote opening sequence: (5,2) (php)
552 !! options
553 php
554 !! input
555 '''''foo''
556 !! result
557 <p><b><i>foo</i></b>
558 </p>
559 !!end
560 # Parsoid reverses the nesting order, compared to the PHP parser
561 !! test
562 Italics and bold: 5-quote opening sequence: (5,2) (parsoid)
563 !! options
564 parsoid
565 !! input
566 '''''foo''
567 !! result
568 <p><i><b>foo</b></i>
569 </p>
570 !!end
571
572
573 !! test
574 Italics and bold: 5-quote opening sequence: (5,3)
575 !! input
576 '''''foo'''
577 !! result
578 <p><i><b>foo</b></i>
579 </p>
580 !!end
581
582
583 !! test
584 Italics and bold: 5-quote opening sequence: (5,4)
585 !! input
586 '''''foo''''
587 !! result
588 <p><i><b>foo'</b></i>
589 </p>
590 !!end
591
592
593 !! test
594 Italics and bold: 5-quote opening sequence: (5,5)
595 !! input
596 '''''foo'''''
597 !! result
598 <p><i><b>foo</b></i>
599 </p>
600 !!end
601
602 ###
603 ### multiple quote sequences in a line
604 ###
605 !! test
606 Italics and bold: multiple quote sequences: (2,4,2)
607 !! input
608 ''foo''''bar''
609 !! result
610 <p><i>foo'<b>bar</b></i>
611 </p>
612 !!end
613
614
615 !! test
616 Italics and bold: multiple quote sequences: (2,4,3)
617 !! input
618 ''foo''''bar'''
619 !! result
620 <p><i>foo'<b>bar</b></i>
621 </p>
622 !!end
623
624
625 !! test
626 Italics and bold: multiple quote sequences: (2,4,4)
627 !! input
628 ''foo''''bar''''
629 !! result
630 <p><i>foo'<b>bar'</b></i>
631 </p>
632 !!end
633
634
635 !! test
636 Italics and bold: multiple quote sequences: (3,4,2) (php)
637 !! options
638 php
639 !! input
640 '''foo''''bar''
641 !! result
642 <p><b>foo'</b>bar
643 </p>
644 !!end
645 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
646 !! test
647 Italics and bold: multiple quote sequences: (3,4,2) (parsoid)
648 !! options
649 parsoid
650 !! input
651 '''foo''''bar''
652 !! result
653 <p><b>foo'</b>bar<i></i>
654 </p>
655 !!end
656
657
658 !! test
659 Italics and bold: multiple quote sequences: (3,4,3) (php)
660 !! options
661 php
662 !! input
663 '''foo''''bar'''
664 !! result
665 <p><b>foo'</b>bar
666 </p>
667 !!end
668 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
669 !! test
670 Italics and bold: multiple quote sequences: (3,4,3) (parsoid)
671 !! options
672 parsoid
673 !! input
674 '''foo''''bar'''
675 !! result
676 <p><b>foo'</b>bar<b></b>
677 </p>
678 !!end
679
680 ###
681 ### other quote tests
682 ###
683 !! test
684 Italics and bold: other quote tests: (2,3,5)
685 !! input
686 ''this is about '''foo's family'''''
687 !! result
688 <p><i>this is about <b>foo's family</b></i>
689 </p>
690 !!end
691
692
693 !! test
694 Italics and bold: other quote tests: (2,(3,3),2)
695 !! input
696 ''this is about '''foo's''' family''
697 !! result
698 <p><i>this is about <b>foo's</b> family</i>
699 </p>
700 !!end
701
702
703 !! test
704 Italics and bold: other quote tests: (3,2,3,2)
705 !! input
706 '''this is about ''foo'''s family''
707 !! result
708 <p><b>this is about <i>foo</i></b><i>s family</i>
709 </p>
710 !!end
711
712
713 # The Parsoid team believes the PHP parser's output on this test is wrong.
714 # It only checks for convert-to-bold-on-single-character-word when the word
715 # matches with a bold tag ("'''") that is *odd* in the list of quote tokens.
716 # This means that the bold token in position 2 (0-indexed) gets converted by
717 # parsoid, but doesn't get changed by the PHP parser.
718 !! test
719 Italics and bold: other quote tests: (3,2,3,3) (php)
720 !! options
721 php
722 !! input
723 '''this is about ''foo'''s family'''
724 !! result
725 <p>'<i>this is about </i>foo<b>s family</b>
726 </p>
727 !!end
728 # This is the output the Parsoid team believes to be correct.
729 !! test
730 Italics and bold: other quote tests: (3,2,3,3) (parsoid)
731 !! options
732 parsoid
733 !! input
734 '''this is about ''foo'''s family'''
735 !! result
736 <p><b>this is about <i>foo'</i>s family</b>
737 </p>
738 !!end
739
740
741 !! test
742 Italics and bold: other quote tests: (3,(2,2),3)
743 !! input
744 '''this is about ''foo's'' family'''
745 !! result
746 <p><b>this is about <i>foo's</i> family</b>
747 </p>
748 !!end
749
750
751 !! test
752 Italicized possessive
753 !! input
754 The ''[[Main Page]]'''s talk page.
755 !! result
756 <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
757 </p>
758 !! end
759
760 ###
761 ### Non-html5 tags
762 ###
763
764 !! test
765 Non-html5 tags should be accepted
766 !! input
767 <center>''foo''</center>
768 <big>''foo''</big>
769 <font>''foo''</font>
770 <strike>''foo''</strike>
771 <tt>''foo''</tt>
772 !! result
773 <center><i>foo</i></center>
774 <p><big><i>foo</i></big>
775 <font><i>foo</i></font>
776 <strike><i>foo</i></strike>
777 <tt><i>foo</i></tt>
778 </p>
779 !! end
780
781 ###
782 ### <nowiki> test cases
783 ###
784
785 !! test
786 <nowiki> unordered list
787 !! input
788 <nowiki>* This is not an unordered list item.</nowiki>
789 !! result
790 <p>* This is not an unordered list item.
791 </p>
792 !! end
793
794 !! test
795 <nowiki> spacing
796 !! input
797 <nowiki>Lorem ipsum dolor
798
799 sed abit.
800 sed nullum.
801
802 :and a colon
803 </nowiki>
804 !! result
805 <p>Lorem ipsum dolor
806
807 sed abit.
808 sed nullum.
809
810 :and a colon
811
812 </p>
813 !! end
814
815 !! test
816 nowiki 3
817 !! input
818 :There is not nowiki.
819 :There is <nowiki>nowiki</nowiki>.
820
821 #There is not nowiki.
822 #There is <nowiki>nowiki</nowiki>.
823
824 *There is not nowiki.
825 *There is <nowiki>nowiki</nowiki>.
826 !! result
827 <dl><dd>There is not nowiki.
828 </dd><dd>There is nowiki.
829 </dd></dl>
830 <ol><li>There is not nowiki.
831 </li><li>There is nowiki.
832 </li></ol>
833 <ul><li>There is not nowiki.
834 </li><li>There is nowiki.
835 </li></ul>
836
837 !! end
838
839 !! test
840 Entities inside <nowiki>
841 !! input
842 <nowiki>&lt;</nowiki>
843 !! result
844 <p>&lt;
845 </p>
846 !! end
847
848
849 ###
850 ### Comments
851 ###
852 !! test
853 Comments and Indent-Pre
854 !! input
855 <!-- comment 1 --> asdf
856
857 <!-- comment 1 --> asdf
858 <!-- comment 2 -->
859
860 <!-- comment 1 --> asdf
861 <!-- comment 2 -->xyz
862
863 <!-- comment 1 --> asdf
864 <!-- comment 2 --> xyz
865 !! result
866 <pre>asdf
867 </pre>
868 <pre>asdf
869 </pre>
870 <pre>asdf
871 </pre>
872 <p>xyz
873 </p>
874 <pre>asdf
875 xyz
876 </pre>
877 !! end
878
879 !! test
880 Comment test 2a
881 !! input
882 asdf
883 <!-- comment 1 -->
884 jkl
885 !! result
886 <p>asdf
887 jkl
888 </p>
889 !! end
890
891 !! test
892 Comment test 2b
893 !! input
894 asdf
895 <!-- comment 1 -->
896
897 jkl
898 !! result
899 <p>asdf
900 </p><p>jkl
901 </p>
902 !! end
903
904 !! test
905 Comment test 3
906 !! input
907 asdf
908 <!-- comment 1 -->
909 <!-- comment 2 -->
910 jkl
911 !! result
912 <p>asdf
913 jkl
914 </p>
915 !! end
916
917 !! test
918 Comment test 4
919 !! input
920 asdf<!-- comment 1 -->jkl
921 !! result
922 <p>asdfjkl
923 </p>
924 !! end
925
926 !! test
927 Comment spacing
928 !! input
929 a
930 <!-- foo --> b <!-- bar -->
931 c
932 !! result
933 <p>a
934 </p>
935 <pre> b
936 </pre>
937 <p>c
938 </p>
939 !! end
940
941 !! test
942 Comment whitespace
943 !! input
944 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
945 !! result
946
947 !! end
948
949 !! test
950 Comment semantics and delimiters
951 !! input
952 <!-- --><!----><!-----><!------>
953 !! result
954
955 !! end
956
957 !! test
958 Comment semantics and delimiters, redux
959 !! input
960 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
961 -- foo -- funky huh? ... -->
962 !! result
963
964 !! end
965
966 !! test
967 Comment semantics and delimiters: directors cut
968 !! input
969 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
970 everything starting with < followed by !-- until the first -- and > we see,
971 that wouldn't be valid XML however, since in XML -- has to terminate a comment
972 -->-->
973 !! result
974 <p>--&gt;
975 </p>
976 !! end
977
978 !! test
979 Comment semantics: nesting
980 !! input
981 <!--<!-- no, we're not going to do anything fancy here -->-->
982 !! result
983 <p>--&gt;
984 </p>
985 !! end
986
987 !! test
988 Comment semantics: unclosed comment at end
989 !! input
990 <!--This comment will run out to the end of the document
991 !! result
992
993 !! end
994
995 !! test
996 Comment in template title
997 !! input
998 {{f<!---->oo}}
999 !! result
1000 <p>FOO
1001 </p>
1002 !! end
1003
1004 !! test
1005 Comment on its own line post-expand
1006 !! input
1007 a
1008 {{blank}}<!---->
1009 b
1010 !! result
1011 <p>a
1012 </p><p>b
1013 </p>
1014 !! end
1015
1016 !! test
1017 Comment on its own line post-expand with non-significant whitespace
1018 !! input
1019 a
1020 {{blank}} <!---->
1021 b
1022 !! result
1023 <p>a
1024 </p><p>b
1025 </p>
1026 !! end
1027
1028 ###
1029 ### paragraph wraping tests
1030 ###
1031 !! test
1032 No block tags
1033 !! input
1034 a
1035
1036 b
1037 !! result
1038 <p>a
1039 </p><p>b
1040 </p>
1041 !! end
1042 !! test
1043 Block tag on one line
1044 !! input
1045 a <div>foo</div>
1046
1047 b
1048 !! result
1049 a <div>foo</div>
1050 <p>b
1051 </p>
1052 !! end
1053
1054 !! test
1055 Block tag on both lines
1056 !! input
1057 a <div>foo</div>
1058
1059 b <div>foo</div>
1060 !! result
1061 a <div>foo</div>
1062 b <div>foo</div>
1063
1064 !! end
1065
1066 !! test
1067 Multiple lines without block tags
1068 !! input
1069 <div>foo</div> a
1070 b
1071 c
1072 d<!--foo--> e
1073 x <div>foo</div> z
1074 !! result
1075 <div>foo</div> a
1076 <p>b
1077 c
1078 d e
1079 </p>
1080 x <div>foo</div> z
1081
1082 !! end
1083
1084 !! test
1085 Empty lines between lines with block tags
1086 !! input
1087 <div></div>
1088
1089
1090 <div></div>a
1091
1092 b
1093 <div>a</div>b
1094
1095 <div>b</div>d
1096
1097
1098 <div>e</div>
1099 !! result
1100 <div></div>
1101 <p><br />
1102 </p>
1103 <div></div>a
1104 <p>b
1105 </p>
1106 <div>a</div>b
1107 <div>b</div>d
1108 <p><br />
1109 </p>
1110 <div>e</div>
1111
1112 !! end
1113
1114 ###
1115 ### Preformatted text
1116 ###
1117 !! test
1118 Preformatted text
1119 !! input
1120 This is some
1121 Preformatted text
1122 With ''italic''
1123 And '''bold'''
1124 And a [[Main Page|link]]
1125 !! result
1126 <pre>This is some
1127 Preformatted text
1128 With <i>italic</i>
1129 And <b>bold</b>
1130 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
1131 </pre>
1132 !! end
1133
1134 !! test
1135 Ident preformatting with inline content
1136 !! input
1137 a
1138 ''b''
1139 !! result
1140 <pre>a
1141 <i>b</i>
1142 </pre>
1143 !! end
1144
1145 !! test
1146 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
1147 !! input
1148 <pre><nowiki>
1149 <b>
1150 <cite>
1151 <em>
1152 </nowiki></pre>
1153 !! result
1154 <pre>
1155 &lt;b&gt;
1156 &lt;cite&gt;
1157 &lt;em&gt;
1158 </pre>
1159
1160 !! end
1161
1162 !! test
1163 Regression with preformatted in <center>
1164 !! input
1165 <center>
1166 Blah
1167 </center>
1168 !! result
1169 <center>
1170 <pre>Blah
1171 </pre>
1172 </center>
1173
1174 !! end
1175
1176 # Expected output in the following test is not really expected (there should be
1177 # <pre> in the output) -- it's only testing for well-formedness.
1178 !! test
1179 Bug 6200: Preformatted in <blockquote>
1180 !! input
1181 <blockquote>
1182 Blah
1183 </blockquote>
1184 !! result
1185 <blockquote>
1186 Blah
1187 </blockquote>
1188
1189 !! end
1190
1191 !! test
1192 <pre> with attributes (bug 3202)
1193 !! input
1194 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1195 !! result
1196 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
1197
1198 !! end
1199
1200 !! test
1201 <pre> with width attribute (bug 3202)
1202 !! input
1203 <pre width="8">Narrow screen goodies</pre>
1204 !! result
1205 <pre width="8">Narrow screen goodies</pre>
1206
1207 !! end
1208
1209 !! test
1210 <pre> with forbidden attribute (bug 3202)
1211 !! input
1212 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
1213 !! result
1214 <pre width="8">Narrow screen goodies</pre>
1215
1216 !! end
1217
1218 !! test
1219 Entities inside <pre>
1220 !! input
1221 <pre>&lt;</pre>
1222 !! result
1223 <pre>&lt;</pre>
1224
1225 !! end
1226
1227 !! test
1228 <pre> with forbidden attribute values (bug 3202)
1229 !! input
1230 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
1231 !! result
1232 <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
1233
1234 !! end
1235
1236 !! test
1237 <nowiki> inside <pre> (bug 13238)
1238 !! input
1239 <pre>
1240 <nowiki>
1241 </pre>
1242 <pre>
1243 <nowiki></nowiki>
1244 </pre>
1245 <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
1246 !! result
1247 <pre>
1248 &lt;nowiki&gt;
1249 </pre>
1250 <pre>
1251
1252 </pre>
1253 <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
1254
1255 !! end
1256
1257 !! test
1258 <nowiki> and <pre> preference (first one wins)
1259 !! input
1260 <pre>
1261 <nowiki>
1262 </pre>
1263 </nowiki>
1264 </pre>
1265
1266 <nowiki>
1267 <pre>
1268 <nowiki>
1269 </pre>
1270 </nowiki>
1271 </pre>
1272
1273 !! result
1274 <pre>
1275 &lt;nowiki&gt;
1276 </pre>
1277 <p>&lt;/nowiki&gt;
1278 &lt;/pre&gt;
1279 </p><p>
1280 &lt;pre&gt;
1281 &lt;nowiki&gt;
1282 &lt;/pre&gt;
1283
1284 &lt;/pre&gt;
1285 </p>
1286 !! end
1287
1288 !! test
1289 </pre> inside nowiki
1290 !! input
1291 <nowiki></pre></nowiki>
1292 !! result
1293 <p>&lt;/pre&gt;
1294 </p>
1295 !! end
1296
1297 !!test
1298 Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
1299 !!input
1300 {{echo|}}
1301 !!result
1302
1303 !!end
1304
1305 !!test
1306 Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
1307 !!input
1308 {{echo|
1309 foo}}
1310 !!result
1311 <p>foo
1312 </p>
1313 !!end
1314
1315 !! test
1316 Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
1317 !! input
1318 {{echo|a
1319 b}}
1320 !!result
1321 <pre>a
1322 </pre>
1323 <p>b
1324 </p>
1325 !!end
1326
1327 !! test
1328 Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
1329 !! input
1330 {{echo|a
1331 b
1332 c
1333 d
1334 e
1335 }}
1336 !!result
1337 <pre>a
1338 </pre>
1339 <p>b
1340 c
1341 </p>
1342 <pre>d
1343 </pre>
1344 <p>e
1345 </p>
1346 !!end
1347
1348 !!test
1349 Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
1350 !!input
1351 {{echo| foo}}
1352
1353 {{echo| foo}}{{echo| bar}}
1354
1355 {{echo| foo}}
1356 {{echo| bar}}
1357
1358 {{echo|<!--cmt--> foo}}
1359
1360 <!--cmt-->{{echo| foo}}
1361
1362 {{echo|{{echo| }}bar}}
1363 !!result
1364 <pre>foo
1365 </pre>
1366 <pre>foo bar
1367 </pre>
1368 <pre>foo
1369 bar
1370 </pre>
1371 <pre>foo
1372 </pre>
1373 <pre>foo
1374 </pre>
1375 <pre>bar
1376 </pre>
1377 !!end
1378
1379 !! test
1380 Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
1381 !! input
1382 {{echo| }}a
1383
1384 {{echo|
1385 }}a
1386
1387 {{echo|
1388 b}}
1389
1390 {{echo|a
1391 }}b
1392
1393 {{echo|a
1394 }} b
1395 !!result
1396 <pre>a
1397 </pre>
1398 <p><br />
1399 </p>
1400 <pre>a
1401 </pre>
1402 <p><br />
1403 </p>
1404 <pre>b
1405 </pre>
1406 <p>a
1407 </p>
1408 <pre>b
1409 </pre>
1410 <p>a
1411 </p>
1412 <pre>b
1413 </pre>
1414 !!end
1415
1416 !! test
1417 Templates: Single-line variant of parameter whitespace stripping test
1418 !! input
1419 {{echo| a}}
1420
1421 {{echo|1= a}}
1422
1423 {{echo|{{echo| a}}}}
1424
1425 {{echo|1={{echo| a}}}}
1426 !! result
1427 <pre>a
1428 </pre>
1429 <p>a
1430 </p>
1431 <pre>a
1432 </pre>
1433 <p>a
1434 </p>
1435 !! end
1436
1437 !! test
1438 Templates: Strip whitespace from named parameters, but not positional ones
1439 !! input
1440 {{echo|
1441 foo}}
1442
1443 {{echo|
1444 * foo}}
1445
1446 {{echo| 1 =
1447 foo}}
1448
1449 {{echo| 1 =
1450 * foo}}
1451 !! result
1452 <pre>foo
1453 </pre>
1454 <p><br />
1455 </p>
1456 <ul><li> foo
1457 </li></ul>
1458 <p>foo
1459 </p>
1460 <ul><li> foo
1461 </li></ul>
1462
1463 !! end
1464
1465 ###
1466 ### Parsoid-centric tests for testing RT edge cases for pre
1467 ###
1468
1469 !!test
1470 1a. Indent-Pre and Comments
1471 !!input
1472 a
1473 <!--a-->
1474 c
1475 !!result
1476 <pre>a
1477 </pre>
1478 <p>c
1479 </p>
1480 !!end
1481
1482 !!test
1483 1b. Indent-Pre and Comments
1484 !!input
1485 a
1486 <!--a-->
1487 c
1488 !!result
1489 <pre>a
1490 </pre>
1491 <p>c
1492 </p>
1493 !!end
1494
1495 !!test
1496 1c. Indent-Pre and Comments
1497 !!input
1498 <!--a--> a
1499
1500 <!--a--> a
1501 !!result
1502 <pre> a
1503 </pre>
1504 <pre> a
1505 </pre>
1506 !!end
1507
1508 !!test
1509 2a. Indent-Pre and tables
1510 !!input
1511 {|
1512 |-
1513 !h1!!h2
1514 |foo||bar
1515 |}
1516 !!result
1517 <table>
1518
1519 <tr>
1520 <th>h1</th>
1521 <th>h2
1522 </th>
1523 <td>foo</td>
1524 <td>bar
1525 </td></tr></table>
1526
1527 !!end
1528
1529 !!test
1530 2b. Indent-Pre and tables
1531 !!input
1532 {|
1533 |-
1534 |foo
1535 |}
1536 !!result
1537 <table>
1538
1539 <tr>
1540 <td>foo
1541 </td></tr></table>
1542
1543 !!end
1544
1545 !!test
1546 2c. Indent-Pre and tables (bug 42252)
1547 !!input
1548 {|
1549 |+ foo
1550 ! | bar
1551 |}
1552 !!result
1553 <table>
1554 <caption> foo
1555 </caption>
1556 <tr>
1557 <th> bar
1558 </th></tr></table>
1559
1560 !!end
1561
1562 !!test
1563 3a. Indent-Pre and block tags (single-line html)
1564 !!input
1565 <p> foo </p>
1566 <div> foo </div>
1567 <span> foo </span>
1568 !!result
1569 <p> foo </p>
1570 <div> foo </div>
1571 <pre><span> foo </span>
1572 </pre>
1573 !!end
1574
1575 !!test
1576 3b. Indent-Pre and block tags (pre-content on separate line)
1577 !!input
1578 <p>
1579 foo
1580 </p>
1581
1582 <div>
1583 foo
1584 </div>
1585
1586 <center>
1587 foo
1588 </center>
1589
1590 <blockquote>
1591 foo
1592 </blockquote>
1593
1594 <table><tr><td>
1595 foo
1596 </td></tr></table>
1597
1598 <ul><li>
1599 foo
1600 </li></ul>
1601
1602 !!result
1603 <p>
1604 foo
1605 </p>
1606 <div>
1607 <pre>foo
1608 </pre>
1609 </div>
1610 <center>
1611 <pre>foo
1612 </pre>
1613 </center>
1614 <blockquote>
1615 foo
1616 </blockquote>
1617 <table><tr><td>
1618 <pre>foo
1619 </pre>
1620 </td></tr></table>
1621 <ul><li>
1622 foo
1623 </li></ul>
1624
1625 !!end
1626
1627 !!test
1628 4. Multiple spaces at start-of-line
1629 !!input
1630 <p> foo </p>
1631 foo
1632 {|
1633 |foo
1634 |}
1635 !!result
1636 <p> foo </p>
1637 <pre> foo
1638 </pre>
1639 <table>
1640 <tr>
1641 <td>foo
1642 </td></tr></table>
1643
1644 !!end
1645
1646 !! test
1647 5. White-space in indent-pre
1648 NOTE: the white-space char on 2nd line is significant
1649 !! input
1650 a<br/>
1651
1652 b
1653 !! result
1654 <pre>a<br />
1655
1656 b
1657 </pre>
1658 !! end
1659
1660 ###
1661 ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
1662 ###
1663
1664 !!test
1665 HTML-pre: 1. embedded newlines
1666 !!input
1667 <pre>foo</pre>
1668
1669 <pre>
1670 foo
1671 </pre>
1672
1673 <pre>
1674
1675 foo
1676 </pre>
1677
1678 <pre>
1679
1680
1681 foo
1682 </pre>
1683 !!result
1684 <pre>foo</pre>
1685 <pre>
1686 foo
1687 </pre>
1688 <pre>
1689
1690 foo
1691 </pre>
1692 <pre>
1693
1694
1695 foo
1696 </pre>
1697
1698 !!end
1699
1700 !!test
1701 HTML-pre: 2: indented text
1702 !!input
1703 <pre>
1704 foo
1705 </pre>
1706 !!result
1707 <pre>
1708 foo
1709 </pre>
1710
1711 !!end
1712
1713 !!test
1714 HTML-pre: 3: other wikitext
1715 !!input
1716 <pre>
1717 * foo
1718 # bar
1719 = no-h =
1720 '' no-italic ''
1721 [[ NoLink ]]
1722 </pre>
1723 !!result
1724 <pre>
1725 * foo
1726 # bar
1727 = no-h =
1728 '' no-italic ''
1729 [[ NoLink ]]
1730 </pre>
1731
1732 !!end
1733
1734 ###
1735 ### Definition lists
1736 ###
1737 !! test
1738 Simple definition
1739 !! input
1740 ; name : Definition
1741 !! result
1742 <dl><dt> name&#160;</dt><dd> Definition
1743 </dd></dl>
1744
1745 !! end
1746
1747 !! test
1748 Definition list for indentation only
1749 !! input
1750 : Indented text
1751 !! result
1752 <dl><dd> Indented text
1753 </dd></dl>
1754
1755 !! end
1756
1757 !! test
1758 Definition list with no space
1759 !! input
1760 ;name:Definition
1761 !! result
1762 <dl><dt>name</dt><dd>Definition
1763 </dd></dl>
1764
1765 !!end
1766
1767 !! test
1768 Definition list with URL link
1769 !! input
1770 ; http://example.com/ : definition
1771 !! result
1772 <dl><dt> <a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt><dd> definition
1773 </dd></dl>
1774
1775 !! end
1776
1777 !! test
1778 Definition list with bracketed URL link
1779 !! input
1780 ;[http://www.example.com/ Example]:Something about it
1781 !! result
1782 <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt><dd>Something about it
1783 </dd></dl>
1784
1785 !! end
1786
1787 !! test
1788 Definition list with wikilink containing colon
1789 !! input
1790 ; [[Help:FAQ]]: The least-read page on Wikipedia
1791 !! result
1792 <dl><dt> <a href="/index.php?title=Help:FAQ&amp;action=edit&amp;redlink=1" class="new" title="Help:FAQ (page does not exist)">Help:FAQ</a></dt><dd> The least-read page on Wikipedia
1793 </dd></dl>
1794
1795 !! end
1796
1797 # At Brion's and JeLuF's insistence... :)
1798 !! test
1799 Definition list with news link containing colon
1800 !! input
1801 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
1802 !! result
1803 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt><dd> This isn't even a real newsgroup!
1804 </dd></dl>
1805
1806 !! end
1807
1808 !! test
1809 Malformed definition list with colon
1810 !! input
1811 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
1812 !! result
1813 <dl><dt> <a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a> -- don't crash or enter an infinite loop
1814 </dt></dl>
1815
1816 !! end
1817
1818 !! test
1819 Definition lists: colon in external link text
1820 !! input
1821 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
1822 !! result
1823 <dl><dt> <a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;: The Next Generation</a></dt><dd> OK, I made that up
1824 </dd></dl>
1825
1826 !! end
1827
1828 !! test
1829 Definition lists: colon in HTML attribute
1830 !! input
1831 ;<b style="display: inline">bold</b>
1832 !! result
1833 <dl><dt><b style="display: inline">bold</b>
1834 </dt></dl>
1835
1836 !! end
1837
1838 !! test
1839 Definition lists: self-closed tag
1840 !! input
1841 ;one<br/>two : two-line fun
1842 !! result
1843 <dl><dt>one<br />two&#160;</dt><dd> two-line fun
1844 </dd></dl>
1845
1846 !! end
1847
1848 !! test
1849 Bug 11748: Literal closing tags
1850 !! input
1851 <dl>
1852 <dt>test 1</dt>
1853 <dd>test test test test test</dd>
1854 <dt>test 2</dt>
1855 <dd>test test test test test</dd>
1856 </dl>
1857 !! result
1858 <dl>
1859 <dt>test 1</dt>
1860 <dd>test test test test test</dd>
1861 <dt>test 2</dt>
1862 <dd>test test test test test</dd>
1863 </dl>
1864
1865 !! end
1866
1867 !! test
1868 Definition and unordered list using wiki syntax nested in unordered list using html tags.
1869 !! input
1870 <ul><li>
1871 ; term : description
1872 * unordered
1873 </li>
1874 </ul>
1875 !! result
1876 <ul><li>
1877 <dl><dt> term&#160;</dt><dd> description
1878 </dd></dl>
1879 <ul><li> unordered
1880 </li></ul>
1881 </li>
1882 </ul>
1883
1884 !! end
1885
1886 !! test
1887
1888 Definition list with empty definition and following paragraph
1889 !! input
1890 ; term:
1891 Paragraph text
1892 !! result
1893 <dl><dt> term</dt><dd>
1894 </dd></dl>
1895 <p>Paragraph text
1896 </p>
1897 !! end
1898
1899 !! test
1900 Nested definition lists using html syntax
1901 !! input
1902 <dl><dd>
1903 <dl>
1904 <dd>Foo</dd>
1905 </dl>
1906 </dd></dl>
1907 !! result
1908 <dl><dd>
1909 <dl>
1910 <dd>Foo</dd>
1911 </dl>
1912 </dd></dl>
1913
1914 !! end
1915
1916 !! test
1917 Definition Lists: No nesting: Multiple dd's
1918 !! input
1919 ;x
1920 :a
1921 :b
1922 !! result
1923 <dl><dt>x
1924 </dt><dd>a
1925 </dd><dd>b
1926 </dd></dl>
1927
1928 !! end
1929
1930 !! test
1931 Definition Lists: Indentation: Regular
1932 !! input
1933 :i1
1934 ::i2
1935 :::i3
1936 !! result
1937 <dl><dd>i1
1938 <dl><dd>i2
1939 <dl><dd>i3
1940 </dd></dl>
1941 </dd></dl>
1942 </dd></dl>
1943
1944 !! end
1945
1946 !! test
1947 Definition Lists: Indentation: Missing 1st level
1948 !! input
1949 ::i2
1950 :::i3
1951 !! result
1952 <dl><dd><dl><dd>i2
1953 <dl><dd>i3
1954 </dd></dl>
1955 </dd></dl>
1956 </dd></dl>
1957
1958 !! end
1959
1960 !! test
1961 Definition Lists: Indentation: Multi-level indent
1962 !! input
1963 :::i3
1964 !! result
1965 <dl><dd><dl><dd><dl><dd>i3
1966 </dd></dl>
1967 </dd></dl>
1968 </dd></dl>
1969
1970 !! end
1971
1972 !! test
1973 Definition Lists: Hacky use to indent tables
1974 !! input
1975 ::{|
1976 |foo
1977 |bar
1978 |}
1979 this text
1980 should be left alone
1981 !! result
1982 <dl><dd><dl><dd><table>
1983 <tr>
1984 <td>foo
1985 </td>
1986 <td>bar
1987 </td></tr></table></dd></dl></dd></dl>
1988 <p>this text
1989 should be left alone
1990 </p>
1991 !! end
1992 ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
1993 ## as an empty dt item. It also ignores all but the last ";" when followed
1994 ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
1995 ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
1996 ## ";"s.
1997 ##
1998 ## Ex: ";;t2 ::d2" is transformed into:
1999 ##
2000 ## <dl>
2001 ## <dt>t2 </dt>
2002 ## <dd>
2003 ## <dl>
2004 ## <dt></dt>
2005 ## <dd>d2</dd>
2006 ## </dl>
2007 ## </dd>
2008 ## </dl>
2009 ##
2010 ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
2011 ## So, the same wikitext above (;;t2 ::d2) is transformed into:
2012 ##
2013 ## <dl>
2014 ## <dt>
2015 ## <dl>
2016 ## <dt>t2 </dt>
2017 ## <dd>:d2</dd>
2018 ## </dl>
2019 ## </dt>
2020 ## </dl>
2021 ##
2022 ## All Parsoid only definition list tests have this difference.
2023 ##
2024 ## See also: https://bugzilla.wikimedia.org/show_bug.cgi?id=6569
2025 ## and http://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
2026
2027 !! test
2028 Table / list interaction: indented table with lists in table contents
2029 !! input
2030 :{|
2031 |-
2032 | a
2033 * b
2034 |-
2035 | c
2036 * d
2037 |}
2038 !! result
2039 <dl><dd><table>
2040
2041 <tr>
2042 <td> a
2043 <ul><li> b
2044 </li></ul>
2045 </td></tr>
2046 <tr>
2047 <td> c
2048 <ul><li> d
2049 </li></ul>
2050 </td></tr></table></dd></dl>
2051
2052 !! end
2053
2054 !!test
2055 Table / list interaction: lists nested in tables nested in indented lists
2056 !!input
2057 :{|
2058 |
2059 :a
2060 :b
2061 |
2062 *c
2063 *d
2064 |}
2065
2066 *e
2067 *f
2068 !!result
2069 <dl><dd><table>
2070 <tr>
2071 <td>
2072 <dl><dd>a
2073 </dd><dd>b
2074 </dd></dl>
2075 </td>
2076 <td>
2077 <ul><li>c
2078 </li><li>d
2079 </li></ul>
2080 </td></tr></table></dd></dl>
2081 <ul><li>e
2082 </li><li>f
2083 </li></ul>
2084
2085 !!end
2086
2087 !! test
2088 Definition Lists: Nesting: Multi-level (Parsoid only)
2089 !! options
2090 parsoid
2091 !! input
2092 ;t1 :d1
2093 ;;t2 ::d2
2094 ;;;t3 :::d3
2095 !! result
2096 <dl>
2097 <dt>t1 </dt>
2098 <dd>d1</dd>
2099 <dt>
2100 <dl>
2101 <dt>t2 </dt>
2102 <dd>:d2</dd>
2103 <dt>
2104 <dl>
2105 <dt>t3 </dt>
2106 <dd>::d3</dd>
2107 </dl>
2108 </dt>
2109 </dl>
2110 </dt>
2111 </dl>
2112
2113
2114 !! end
2115
2116
2117 !! test
2118 Definition Lists: Nesting: Test 2 (Parsoid only)
2119 !! options
2120 parsoid
2121 !! input
2122 ;t1
2123 ::d2
2124 !! result
2125 <dl>
2126 <dt>t1</dt>
2127 <dd>
2128 <dl>
2129 <dd>d2</dd>
2130 </dl>
2131 </dd>
2132 </dl>
2133
2134 !! end
2135
2136
2137 !! test
2138 Definition Lists: Nesting: Test 3 (Parsoid only)
2139 !! options
2140 parsoid
2141 !! input
2142 :;t1
2143 ::::d2
2144 !! result
2145 <dl>
2146 <dd>
2147 <dl>
2148 <dt>t1</dt>
2149 <dd>
2150 <dl>
2151 <dd>
2152 <dl>
2153 <dd>d2</dd>
2154 </dl>
2155 </dd>
2156 </dl>
2157 </dd>
2158 </dl>
2159 </dd>
2160 </dl>
2161
2162 !! end
2163
2164
2165 !! test
2166 Definition Lists: Nesting: Test 4
2167 !! input
2168 ::;t3
2169 :::d3
2170 !! result
2171 <dl><dd><dl><dd><dl><dt>t3
2172 </dt><dd>d3
2173 </dd></dl>
2174 </dd></dl>
2175 </dd></dl>
2176
2177 !! end
2178
2179
2180 ## The Parsoid team believes the following three test exposes a
2181 ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
2182 ## wrong to close the <dl> after the <dt> containing the <ul>.)
2183 !! test
2184 Definition Lists: Mixed Lists: Test 1 (php)
2185 !! options
2186 php
2187 !! input
2188 :;* foo
2189 ::* bar
2190 :; baz
2191 !! result
2192 <dl><dd><dl><dt><ul><li> foo
2193 </li><li> bar
2194 </li></ul>
2195 </dt></dl>
2196 <dl><dt> baz
2197 </dt></dl>
2198 </dd></dl>
2199
2200 !! end
2201 !! test
2202 Definition Lists: Mixed Lists: Test 1 (parsoid)
2203 !! options
2204 parsoid
2205 !! input
2206 :;* foo
2207 ::* bar
2208 :; baz
2209 !! result
2210 <dl><dd><dl><dt><ul><li> foo
2211 </li></ul></dt><dd><ul><li> bar
2212 </li></ul></dd><dt> baz</dt></dl></dd></dl>
2213 !! end
2214
2215 !! test
2216 Definition Lists: Mixed Lists: Test 2
2217 !! input
2218 *: d1
2219 *: d2
2220 !! result
2221 <ul><li><dl><dd> d1
2222 </dd><dd> d2
2223 </dd></dl>
2224 </li></ul>
2225
2226 !! end
2227
2228
2229 !! test
2230 Definition Lists: Mixed Lists: Test 3
2231 !! input
2232 *::: d1
2233 *::: d2
2234 !! result
2235 <ul><li><dl><dd><dl><dd><dl><dd> d1
2236 </dd><dd> d2
2237 </dd></dl>
2238 </dd></dl>
2239 </dd></dl>
2240 </li></ul>
2241
2242 !! end
2243
2244
2245 !! test
2246 Definition Lists: Mixed Lists: Test 4
2247 !! input
2248 *;d1 :d2
2249 *;d3 :d4
2250 !! result
2251 <ul><li><dl><dt>d1&#160;</dt><dd>d2
2252 </dd><dt>d3&#160;</dt><dd>d4
2253 </dd></dl>
2254 </li></ul>
2255
2256 !! end
2257
2258
2259 !! test
2260 Definition Lists: Mixed Lists: Test 5
2261 !! input
2262 *:d1
2263 *:: d2
2264 !! result
2265 <ul><li><dl><dd>d1
2266 <dl><dd> d2
2267 </dd></dl>
2268 </dd></dl>
2269 </li></ul>
2270
2271 !! end
2272
2273
2274 !! test
2275 Definition Lists: Mixed Lists: Test 6
2276 !! input
2277 #*:d1
2278 #*::: d3
2279 !! result
2280 <ol><li><ul><li><dl><dd>d1
2281 <dl><dd><dl><dd> d3
2282 </dd></dl>
2283 </dd></dl>
2284 </dd></dl>
2285 </li></ul>
2286 </li></ol>
2287
2288 !! end
2289
2290
2291 !! test
2292 Definition Lists: Mixed Lists: Test 7
2293 !! input
2294 :* d1
2295 :* d2
2296 !! result
2297 <dl><dd><ul><li> d1
2298 </li><li> d2
2299 </li></ul>
2300 </dd></dl>
2301
2302 !! end
2303
2304
2305 !! test
2306 Definition Lists: Mixed Lists: Test 8
2307 !! input
2308 :* d1
2309 ::* d2
2310 !! result
2311 <dl><dd><ul><li> d1
2312 </li></ul>
2313 <dl><dd><ul><li> d2
2314 </li></ul>
2315 </dd></dl>
2316 </dd></dl>
2317
2318 !! end
2319
2320
2321 !! test
2322 Definition Lists: Mixed Lists: Test 9
2323 !! input
2324 *;foo :bar
2325 !! result
2326 <ul><li><dl><dt>foo&#160;</dt><dd>bar
2327 </dd></dl>
2328 </li></ul>
2329
2330 !! end
2331
2332
2333 !! test
2334 Definition Lists: Mixed Lists: Test 10
2335 !! input
2336 *#;foo :bar
2337 !! result
2338 <ul><li><ol><li><dl><dt>foo&#160;</dt><dd>bar
2339 </dd></dl>
2340 </li></ol>
2341 </li></ul>
2342
2343 !! end
2344
2345 # The Parsoid team disagrees with the PHP parser's seemingly-random
2346 # rules regarding dd/dt on the next two tests. Parsoid is more
2347 # consistent, and recognizes the shared nesting and keeps the
2348 # still-open tags around until the nesting is complete.
2349
2350 !! test
2351 Definition Lists: Mixed Lists: Test 11 (php)
2352 !! options
2353 php
2354 !! input
2355 *#*#;*;;foo :bar
2356 *#*#;boo :baz
2357 !! result
2358 <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt><dd><ul><li><dl><dt><dl><dt>bar
2359 </dt></dl>
2360 </dd></dl>
2361 </li></ul>
2362 </dd></dl>
2363 <dl><dt>boo&#160;</dt><dd>baz
2364 </dd></dl>
2365 </li></ol>
2366 </li></ul>
2367 </li></ol>
2368 </li></ul>
2369
2370 !! end
2371 !! test
2372 Definition Lists: Mixed Lists: Test 11 (parsoid)
2373 !! options
2374 parsoid
2375 !! input
2376 *#*#;*;;foo :bar
2377 *#*#;boo :baz
2378 !! result
2379 <ul><li><ol><li><ul><li><ol><li><dl><dt><ul><li><dl><dt><dl><dt>foo&nbsp;</dt><dd>bar
2380 </dd></dl></dt></dl></li></ul></dt><dt>boo&nbsp;</dt><dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
2381 !! end
2382
2383
2384 !! test
2385 Definition Lists: Weird Ones: Test 1 (php)
2386 !! options
2387 php
2388 !! input
2389 *#;*::;; foo : bar (who uses this?)
2390 !! result
2391 <ul><li><ol><li><dl><dt> foo&#160;</dt><dd><ul><li><dl><dd><dl><dd><dl><dt><dl><dt> bar (who uses this?)
2392 </dt></dl>
2393 </dd></dl>
2394 </dd></dl>
2395 </dd></dl>
2396 </li></ul>
2397 </dd></dl>
2398 </li></ol>
2399 </li></ul>
2400
2401 !! end
2402 !! test
2403 Definition Lists: Weird Ones: Test 1 (parsoid)
2404 !! options
2405 parsoid
2406 !! input
2407 *#;*::;; foo : bar (who uses this?)
2408 !! result
2409 <ul><li><ol><li><dl><dt><ul><li><dl><dd><dl><dd><dl><dt><dl><dt> foo&nbsp;</dt><dd> bar (who uses this?)</dd></dl></dt></dl></dd></dl></dd></dl></li></ul></dt></dl></li></ol></li></ul>
2410 !! end
2411
2412 ###
2413 ### External links
2414 ###
2415 !! test
2416 External links: non-bracketed
2417 !! input
2418 Non-bracketed: http://example.com
2419 !! result
2420 <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
2421 </p>
2422 !! end
2423
2424 !! test
2425 External links: numbered
2426 !! input
2427 Numbered: [http://example.com]
2428 Numbered: [http://example.net]
2429 Numbered: [http://example.com]
2430 !! result
2431 <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
2432 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
2433 Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
2434 </p>
2435 !!end
2436
2437 !! test
2438 External links: specified text
2439 !! input
2440 Specified text: [http://example.com link]
2441 !! result
2442 <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
2443 </p>
2444 !!end
2445
2446 !! test
2447 External links: trail
2448 !! input
2449 Linktrails should not work for external links: [http://example.com link]s
2450 !! result
2451 <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
2452 </p>
2453 !! end
2454
2455 !! test
2456 External links: dollar sign in URL
2457 !! input
2458 http://example.com/1$2345
2459 !! result
2460 <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
2461 </p>
2462 !! end
2463
2464 !! test
2465 External links: dollar sign in URL (named)
2466 !! input
2467 [http://example.com/1$2345]
2468 !! result
2469 <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
2470 </p>
2471 !!end
2472
2473 !! test
2474 External links: open square bracket forbidden in URL (bug 4377)
2475 !! input
2476 http://example.com/1[2345
2477 !! result
2478 <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
2479 </p>
2480 !! end
2481
2482 !! test
2483 External links: open square bracket forbidden in URL (named) (bug 4377)
2484 !! input
2485 [http://example.com/1[2345]
2486 !! result
2487 <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
2488 </p>
2489 !!end
2490
2491 !! test
2492 External links: nowiki in URL link text (bug 6230)
2493 !!input
2494 [http://example.com/ <nowiki>''example site''</nowiki>]
2495 !! result
2496 <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
2497 </p>
2498 !! end
2499
2500 !! test
2501 External links: newline forbidden in text (bug 6230 regression check)
2502 !! input
2503 [http://example.com/ first
2504 second]
2505 !! result
2506 <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
2507 second]
2508 </p>
2509 !!end
2510
2511 !! test
2512 External links: Pipe char between url and text
2513 !! input
2514 [http://example.com | link]
2515 !! result
2516 <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
2517 </p>
2518 !!end
2519
2520 !! test
2521 External links: protocol-relative URL in brackets
2522 !! input
2523 [//example.com/ Test]
2524 !! result
2525 <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
2526 </p>
2527 !! end
2528
2529 !! test
2530 External links: protocol-relative URL in brackets without text
2531 !! input
2532 [//example.com]
2533 !! result
2534 <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
2535 </p>
2536 !! end
2537
2538 !! test
2539 External links: protocol-relative URL in free text is left alone
2540 !! input
2541 //example.com/Foo
2542 !! result
2543 <p>//example.com/Foo
2544 </p>
2545 !!end
2546
2547 !! test
2548 External links: protocol-relative URL in the middle of a word is left alone (bug 30269)
2549 !! input
2550 foo//example.com/Foo
2551 !! result
2552 <p>foo//example.com/Foo
2553 </p>
2554 !! end
2555
2556 !! test
2557 External image
2558 !! input
2559 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
2560 !! result
2561 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
2562 </p>
2563 !! end
2564
2565 !! test
2566 External image from https
2567 !! input
2568 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
2569 !! result
2570 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
2571 </p>
2572 !! end
2573
2574 !! test
2575 Link to non-http image, no img tag
2576 !! input
2577 Link to non-http image, no img tag: ftp://example.com/test.jpg
2578 !! result
2579 <p>Link to non-http image, no img tag: <a rel="nofollow" class="external free" href="ftp://example.com/test.jpg">ftp://example.com/test.jpg</a>
2580 </p>
2581 !! end
2582
2583 !! test
2584 External links: terminating separator
2585 !! input
2586 Terminating separator: http://example.com/thing,
2587 !! result
2588 <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
2589 </p>
2590 !! end
2591
2592 !! test
2593 External links: intervening separator
2594 !! input
2595 Intervening separator: http://example.com/1,2,3
2596 !! result
2597 <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
2598 </p>
2599 !! end
2600
2601 !! test
2602 External links: old bug with URL in query
2603 !! input
2604 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
2605 !! result
2606 <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
2607 </p>
2608 !! end
2609
2610 !! test
2611 External links: old URL-in-URL bug, mixed protocols
2612 !! input
2613 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
2614 !! result
2615 <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
2616 </p>
2617 !!end
2618
2619 !! test
2620 External links: URL in text
2621 !! input
2622 URL in text: [http://example.com http://example.com]
2623 !! result
2624 <p>URL in text: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
2625 </p>
2626 !! end
2627
2628 !! test
2629 External links: Clickable images
2630 !! input
2631 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
2632 !! result
2633 <p>ja-style clickable images: <a rel="nofollow" class="external text" href="http://example.com"><img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" /></a>
2634 </p>
2635 !!end
2636
2637 !! test
2638 External links: raw ampersand
2639 !! input
2640 Old &amp; use: http://x&y
2641 !! result
2642 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
2643 </p>
2644 !! end
2645
2646 !! test
2647 External links: encoded ampersand
2648 !! input
2649 Old &amp; use: http://x&amp;y
2650 !! result
2651 <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
2652 </p>
2653 !! end
2654
2655 !! test
2656 External links: encoded equals (bug 6102)
2657 !! input
2658 http://example.com/?foo&#61;bar
2659 !! result
2660 <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
2661 </p>
2662 !! end
2663
2664 !! test
2665 External links: [raw ampersand]
2666 !! input
2667 Old &amp; use: [http://x&y]
2668 !! result
2669 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
2670 </p>
2671 !! end
2672
2673 !! test
2674 External links: [encoded ampersand]
2675 !! input
2676 Old &amp; use: [http://x&amp;y]
2677 !! result
2678 <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
2679 </p>
2680 !! end
2681
2682 !! test
2683 External links: [encoded equals] (bug 6102)
2684 !! input
2685 [http://example.com/?foo&#61;bar]
2686 !! result
2687 <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
2688 </p>
2689 !! end
2690
2691 !! test
2692 External links: [IDN ignored character reference in hostname; strip it right off]
2693 !! input
2694 [http://e&zwnj;xample.com/]
2695 !! result
2696 <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
2697 </p>
2698 !! end
2699
2700 # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
2701 # Where an external link could easily circumvent the sanitization of the text of
2702 # a link like this (where an IDN-ignore character is in the URL somewhere), this
2703 # test demands a higher standard. That's a bit strange.
2704 #
2705 # Example:
2706 #
2707 # http://e‌xample.com -> [http://example.com|http://example.com]
2708 # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
2709 #
2710 # The first example is sanitized, but the second is not. Any security benefits
2711 # from this production are trivial to circumvent. Either remove this test and
2712 # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
2713 # the test accordingly.
2714 #
2715 # All our love,
2716 # The Parsoid team.
2717 !! test
2718 External links: IDN ignored character reference in hostname; strip it right off
2719 !! input
2720 http://e&zwnj;xample.com/
2721 !! result
2722 <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
2723 </p>
2724 !! end
2725
2726 !! test
2727 External links: www.jpeg.org (bug 554)
2728 !! input
2729 http://www.jpeg.org
2730 !!result
2731 <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
2732 </p>
2733 !! end
2734
2735 !! test
2736 External links: URL within URL (original bug 2)
2737 !! input
2738 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
2739 !! result
2740 <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
2741 </p>
2742 !! end
2743
2744 !! test
2745 BUG 361: URL inside bracketed URL
2746 !! input
2747 [http://www.example.com/foo http://www.example.com/bar]
2748 !! result
2749 <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
2750 </p>
2751 !! end
2752
2753 !! test
2754 BUG 361: URL within URL, not bracketed
2755 !! input
2756 http://www.example.com/foo?=http://www.example.com/bar
2757 !! result
2758 <p><a rel="nofollow" class="external free" href="http://www.example.com/foo?=http://www.example.com/bar">http://www.example.com/foo?=http://www.example.com/bar</a>
2759 </p>
2760 !! end
2761
2762 !! test
2763 BUG 289: ">"-token in URL-tail
2764 !! input
2765 http://www.example.com/<hello>
2766 !! result
2767 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
2768 </p>
2769 !!end
2770
2771 !! test
2772 BUG 289: literal ">"-token in URL-tail
2773 !! input
2774 http://www.example.com/<b>html</b>
2775 !! result
2776 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
2777 </p>
2778 !!end
2779
2780 !! test
2781 BUG 289: ">"-token in bracketed URL
2782 !! input
2783 [http://www.example.com/<hello> stuff]
2784 !! result
2785 <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
2786 </p>
2787 !!end
2788
2789 !! test
2790 BUG 289: literal ">"-token in bracketed URL
2791 !! input
2792 [http://www.example.com/<b>html</b> stuff]
2793 !! result
2794 <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
2795 </p>
2796 !!end
2797
2798 !! test
2799 BUG 289: literal double quote at end of URL
2800 !! input
2801 http://www.example.com/"hello"
2802 !! result
2803 <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
2804 </p>
2805 !!end
2806
2807 !! test
2808 BUG 289: literal double quote in bracketed URL
2809 !! input
2810 [http://www.example.com/"hello" stuff]
2811 !! result
2812 <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
2813 </p>
2814 !!end
2815
2816 !! test
2817 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
2818 !! input
2819 [http://www.example.com test]
2820 !! result
2821 <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
2822 </p>
2823 !! end
2824
2825 !! test
2826 External links: link text with spaces
2827 !! input
2828 [http://www.example.com a b c]
2829 [http://www.example.com ''a'' ''b'']
2830 !! result
2831 <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
2832 <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
2833 </p>
2834 !! end
2835
2836 !! test
2837 External links: wiki links within external link (Bug 3695)
2838 !! input
2839 [http://example.com [[wikilink]] embedded in ext link]
2840 !! result
2841 <p><a rel="nofollow" class="external text" href="http://example.com"></a><a href="/index.php?title=Wikilink&amp;action=edit&amp;redlink=1" class="new" title="Wikilink (page does not exist)">wikilink</a><a rel="nofollow" class="external text" href="http://example.com"> embedded in ext link</a>
2842 </p>
2843 !! end
2844
2845 !! test
2846 BUG 787: Links with one slash after the url protocol are invalid
2847 !! input
2848 http:/example.com
2849
2850 [http:/example.com title]
2851 !! result
2852 <p>http:/example.com
2853 </p><p>[http:/example.com title]
2854 </p>
2855 !! end
2856
2857 !! test
2858 Bracketed external links with template-generated invalid target
2859 !! input
2860 [{{echo|http:/example.com}} title]
2861 !! result
2862 <p>[http:/example.com title]
2863 </p>
2864 !! end
2865
2866 !! test
2867 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
2868 !! input
2869 ''[http://example.com text'']
2870 [http://example.com '''text]'''
2871 ''Something [http://example.com in italic'']
2872 ''Something [http://example.com mixed''''', even bold]'''
2873 '''''Now [http://example.com both''''']
2874 !! result
2875 <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
2876 <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
2877 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
2878 <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
2879 <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
2880 </p>
2881 !! end
2882
2883
2884 !! test
2885 Bug 4781: %26 in URL
2886 !! input
2887 http://www.example.com/?title=AT%26T
2888 !! result
2889 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
2890 </p>
2891 !! end
2892
2893 # According to http://dev.w3.org/html5/spec/Overview.html#parsing-urls a plain
2894 # % is actually legal in HTML5. Any change in output would need testing though.
2895 !! test
2896 Bug 4781, 5267: %25 in URL
2897 !! input
2898 http://www.example.com/?title=100%25_Bran
2899 !! result
2900 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a>
2901 </p>
2902 !! end
2903
2904 !! test
2905 Bug 4781, 5267: %28, %29 in URL
2906 !! input
2907 http://www.example.com/?title=Ben-Hur_%281959_film%29
2908 !! result
2909 <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">http://www.example.com/?title=Ben-Hur_%281959_film%29</a>
2910 </p>
2911 !! end
2912
2913
2914 !! test
2915 Bug 4781: %26 in autonumber URL
2916 !! input
2917 [http://www.example.com/?title=AT%26T]
2918 !! result
2919 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
2920 </p>
2921 !! end
2922
2923 !! test
2924 Bug 4781, 5267: %26 in autonumber URL
2925 !! input
2926 [http://www.example.com/?title=100%25_Bran]
2927 !! result
2928 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
2929 </p>
2930 !! end
2931
2932 !! test
2933 Bug 4781, 5267: %28, %29 in autonumber URL
2934 !! input
2935 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
2936 !! result
2937 <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
2938 </p>
2939 !! end
2940
2941
2942 !! test
2943 Bug 4781: %26 in bracketed URL
2944 !! input
2945 [http://www.example.com/?title=AT%26T link]
2946 !! result
2947 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
2948 </p>
2949 !! end
2950
2951 !! test
2952 Bug 4781, 5267: %26 in bracketed URL
2953 !! input
2954 [http://www.example.com/?title=100%25_Bran link]
2955 !! result
2956 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
2957 </p>
2958 !! end
2959
2960 !! test
2961 Bug 4781, 5267: %28, %29 in bracketed URL
2962 !! input
2963 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
2964 !! result
2965 <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
2966 </p>
2967 !! end
2968
2969 !! test
2970 External link containing double-single-quotes in text '' (bug 4598 sanity check)
2971 !! input
2972 Some [http://example.com/ pretty ''italics'' and stuff]!
2973 !! result
2974 <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
2975 </p>
2976 !! end
2977
2978 !! test
2979 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
2980 !! input
2981 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
2982 !! result
2983 <p><i>Some </i><a rel="nofollow" class="external text" href="http://example.com/"><i>pretty </i>italics<i> and stuff</i></a><i>!</i>
2984 </p>
2985 !! end
2986
2987 !! test
2988 External link containing double-single-quotes with no space separating the url from text in italics
2989 !! input
2990 [http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm''La muerte de Casagemas'' (1901) en el sitio de [[Museo Picasso (París)|Museo Picasso]].]
2991 !! result
2992 <p><a rel="nofollow" class="external text" href="http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm"><i>La muerte de Casagemas</i> (1901) en el sitio de <a href="/index.php?title=Museo_Picasso_(Par%C3%ADs)&amp;action=edit&amp;redlink=1" class="new" title="Museo Picasso (París) (page does not exist)">Museo Picasso</a>.</a>
2993 </p>
2994 !! end
2995
2996 !! test
2997 URL-encoding in URL functions (single parameter)
2998 !! input
2999 {{localurl:Some page|amp=&}}
3000 !! result
3001 <p>/index.php?title=Some_page&amp;amp=&amp;
3002 </p>
3003 !! end
3004
3005 !! test
3006 URL-encoding in URL functions (multiple parameters)
3007 !! input
3008 {{localurl:Some page|q=?&amp=&}}
3009 !! result
3010 <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
3011 </p>
3012 !! end
3013
3014 !! test
3015 Brackets in urls
3016 !! input
3017 http://example.com/index.php?foozoid%5B%5D=bar
3018
3019 http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
3020 !! result
3021 <p><a rel="nofollow" class="external free" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a>
3022 </p><p><a rel="nofollow" class="external free" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a>
3023 </p>
3024 !! end
3025
3026 !! test
3027 IPv6 urls (bug 21261)
3028 !! options
3029 disabled
3030 !! input
3031 http://[2404:130:0:1000::187:2]/index.php
3032 !! result
3033 <p><a rel="nofollow" class="external free" href="http://[2404:130:0:1000::187:2]/index.php">http://[2404:130:0:1000::187:2]/index.php</a>
3034 </p>
3035 !! end
3036
3037 !! test
3038 Non-extlinks in brackets
3039 !! input
3040 [foo]
3041 [foo bar]
3042 [foo ''bar'']
3043 [fool's] errand
3044 [fool's errand]
3045 [{{echo|foo}}]
3046 [{{echo|foo}} bar]
3047 [{{echo|foo}} ''bar'']
3048 [{{echo|foo}}l's] errand
3049 [{{echo|foo}}l's errand]
3050 [url={{echo|foo}}]
3051 [url=http://example.com]
3052 !! result
3053 <p>[foo]
3054 [foo bar]
3055 [foo <i>bar</i>]
3056 [fool's] errand
3057 [fool's errand]
3058 [foo]
3059 [foo bar]
3060 [foo <i>bar</i>]
3061 [fool's] errand
3062 [fool's errand]
3063 [url=foo]
3064 [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
3065 </p>
3066 !! end
3067
3068 ###
3069 ### Quotes
3070 ###
3071
3072 !! test
3073 Quotes
3074 !! input
3075 Normal text. '''Bold text.''' Normal text. ''Italic text.''
3076
3077 Normal text. '''''Bold italic text.''''' Normal text.
3078 !!result
3079 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
3080 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
3081 </p>
3082 !! end
3083
3084
3085 !! test
3086 Unclosed and unmatched quotes (php)
3087 !! options
3088 php
3089 !! input
3090 '''''Bold italic text '''with bold deactivated''' in between.'''''
3091
3092 '''''Bold italic text ''with italic deactivated'' in between.'''''
3093
3094 '''Bold text..
3095
3096 ..spanning two paragraphs (should not work).'''
3097
3098 '''Bold tag left open
3099
3100 ''Italic tag left open
3101
3102 Normal text.
3103
3104 <!-- Unmatching number of opening, closing tags: -->
3105 '''This year''''s election ''should'' beat '''last year''''s.
3106
3107 ''Tom'''s car is bigger than ''Susan'''s.
3108
3109 Plain ''italic'''s plain
3110 !! result
3111 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
3112 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
3113 </p><p><b>Bold text..</b>
3114 </p><p>..spanning two paragraphs (should not work).
3115 </p><p><b>Bold tag left open</b>
3116 </p><p><i>Italic tag left open</i>
3117 </p><p>Normal text.
3118 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
3119 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
3120 </p><p>Plain <i>italic'</i>s plain
3121 </p>
3122 !! end
3123 # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
3124 # parser strips. The wikitext contains just the first half of the bold
3125 # quote pair. (There's also a case where Parsoid nests <b> and <i>
3126 # differently than the PHP parser.)
3127 !! test
3128 Unclosed and unmatched quotes (parsoid)
3129 !! options
3130 parsoid
3131 !! input
3132 '''''Bold italic text '''with bold deactivated''' in between.'''''
3133
3134 '''''Bold italic text ''with italic deactivated'' in between.'''''
3135
3136 '''Bold text..
3137
3138 ..spanning two paragraphs (should not work).'''
3139
3140 '''Bold tag left open
3141
3142 ''Italic tag left open
3143
3144 Normal text.
3145
3146 <!-- Unmatching number of opening, closing tags: -->
3147 '''This year''''s election ''should'' beat '''last year''''s.
3148
3149 ''Tom'''s car is bigger than ''Susan'''s.
3150
3151 Plain ''italic'''s plain
3152 !! result
3153 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
3154 </p><p><i><b>Bold italic text </b></i><b>with italic deactivated<i> in between.</i></b>
3155 </p><p><b>Bold text..</b>
3156 </p><p>..spanning two paragraphs (should not work).<b></b>
3157 </p><p><b>Bold tag left open</b>
3158 </p><p><i>Italic tag left open</i>
3159 </p><p>Normal text.
3160 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
3161 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
3162 </p><p>Plain <i>italic'</i>s plain
3163 </p>
3164 !! end
3165
3166 ###
3167 ### Tables
3168 ###
3169 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
3170 ###
3171
3172 # This should not produce <table></table> as <table><tr><td></td></tr></table>
3173 # is the bare minimun required by the spec, see:
3174 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
3175 !! test
3176 A table with no data. (php)
3177 !! options
3178 php
3179 !! input
3180 {||}
3181 !! result
3182 !! end
3183 # Parsoid team replies: empty table tags are legal in HTML5
3184 !! test
3185 A table with no data. (parsoid)
3186 !! options
3187 parsoid
3188 !! input
3189 {||}
3190 !! result
3191 <table></table>
3192 !! end
3193
3194 # A table with nothing but a caption is invalid XHTML, we might want to render
3195 # this as <p>caption</p>
3196 !! test
3197 A table with nothing but a caption (php)
3198 !! options
3199 php
3200 !! input
3201 {|
3202 |+ caption
3203 |}
3204 !! result
3205 <table>
3206 <caption> caption
3207 </caption><tr><td></td></tr></table>
3208
3209 !! end
3210 # Parsoid team replies: table with only a caption is legal in HTML5
3211 !! test
3212 A table with nothing but a caption (parsoid)
3213 !! options
3214 parsoid
3215 !! input
3216 {|
3217 |+ caption
3218 |}
3219 !! result
3220 <table><caption> caption</caption></table>
3221 !! end
3222
3223 !! test
3224 A table with caption with default-spaced attributes and a table row
3225 !! input
3226 {|
3227 |+ style="color: red;" | caption1
3228 |-
3229 | foo
3230 |}
3231 !! result
3232 <table>
3233 <caption style="color: red;"> caption1
3234 </caption>
3235 <tr>
3236 <td> foo
3237 </td></tr></table>
3238
3239 !! end
3240
3241 !! test
3242 A table with captions with non-default spaced attributes and a table row
3243 !! input
3244 {|
3245 |+style="color: red;"|caption2
3246 |+ style="color: red;"| caption3
3247 |-
3248 | foo
3249 |}
3250 !! result
3251 <table>
3252 <caption style="color: red;">caption2
3253 </caption>
3254 <caption style="color: red;"> caption3
3255 </caption>
3256 <tr>
3257 <td> foo
3258 </td></tr></table>
3259
3260 !! end
3261
3262 !! test
3263 Table td-cell syntax variations
3264 !! input
3265 {|
3266 | foo bar foo | baz
3267 | foo bar foo || baz
3268 | style='color:red;' | baz
3269 | style='color:red;' || baz
3270 |}
3271 !! result
3272 <table>
3273 <tr>
3274 <td> baz
3275 </td>
3276 <td> foo bar foo </td>
3277 <td> baz
3278 </td>
3279 <td style="color:red;"> baz
3280 </td>
3281 <td> style='color:red;' </td>
3282 <td> baz
3283 </td></tr></table>
3284
3285 !! end
3286
3287 !! test
3288 Simple table
3289 !! input
3290 {|
3291 | 1 || 2
3292 |-
3293 | 3 || 4
3294 |}
3295 !! result
3296 <table>
3297 <tr>
3298 <td> 1 </td>
3299 <td> 2
3300 </td></tr>
3301 <tr>
3302 <td> 3 </td>
3303 <td> 4
3304 </td></tr></table>
3305
3306 !! end
3307
3308 !! test
3309 Simple table but with multiple dashes for row wikitext
3310 !! input
3311 {|
3312 | foo
3313 |-----
3314 | bar
3315 |}
3316 !! result
3317 <table>
3318 <tr>
3319 <td> foo
3320 </td></tr>
3321 <tr>
3322 <td> bar
3323 </td></tr></table>
3324
3325 !! end
3326 !! test
3327 Multiplication table
3328 !! input
3329 {| border="1" cellpadding="2"
3330 |+Multiplication table
3331 |-
3332 ! &times; !! 1 !! 2 !! 3
3333 |-
3334 ! 1
3335 | 1 || 2 || 3
3336 |-
3337 ! 2
3338 | 2 || 4 || 6
3339 |-
3340 ! 3
3341 | 3 || 6 || 9
3342 |-
3343 ! 4
3344 | 4 || 8 || 12
3345 |-
3346 ! 5
3347 | 5 || 10 || 15
3348 |}
3349 !! result
3350 <table border="1" cellpadding="2">
3351 <caption>Multiplication table
3352 </caption>
3353 <tr>
3354 <th> &#215; </th>
3355 <th> 1 </th>
3356 <th> 2 </th>
3357 <th> 3
3358 </th></tr>
3359 <tr>
3360 <th> 1
3361 </th>
3362 <td> 1 </td>
3363 <td> 2 </td>
3364 <td> 3
3365 </td></tr>
3366 <tr>
3367 <th> 2
3368 </th>
3369 <td> 2 </td>
3370 <td> 4 </td>
3371 <td> 6
3372 </td></tr>
3373 <tr>
3374 <th> 3
3375 </th>
3376 <td> 3 </td>
3377 <td> 6 </td>
3378 <td> 9
3379 </td></tr>
3380 <tr>
3381 <th> 4
3382 </th>
3383 <td> 4 </td>
3384 <td> 8 </td>
3385 <td> 12
3386 </td></tr>
3387 <tr>
3388 <th> 5
3389 </th>
3390 <td> 5 </td>
3391 <td> 10 </td>
3392 <td> 15
3393 </td></tr></table>
3394
3395 !! end
3396
3397 !! test
3398 Accept "||" in table headings
3399 !! input
3400 {|
3401 !h1 || h2
3402 |}
3403 !! result
3404 <table>
3405 <tr>
3406 <th>h1 </th>
3407 <th> h2
3408 </th></tr></table>
3409
3410 !! end
3411
3412 !! test
3413 Accept "||" in indented table headings
3414 !! input
3415 :{|
3416 !h1 || h2
3417 |}
3418 !! result
3419 <dl><dd><table>
3420 <tr>
3421 <th>h1 </th>
3422 <th> h2
3423 </th></tr></table></dd></dl>
3424
3425 !! end
3426
3427 !! test
3428 Accept empty attributes in td/th cells (td/th cells starting with leading ||)
3429 !! input
3430 {|
3431 !| h1
3432 || a
3433 |}
3434 !! result
3435 <table>
3436 <tr>
3437 <th> h1
3438 </th>
3439 <td> a
3440 </td></tr></table>
3441
3442 !! end
3443
3444 !!test
3445 Accept "| !" at start of line in tables (ignore !-attribute)
3446 !!input
3447 {|
3448 |-
3449 | !style="color:red" | bar
3450 |}
3451 !!result
3452 <table>
3453
3454 <tr>
3455 <td> bar
3456 </td></tr></table>
3457
3458 !!end
3459
3460 !!test
3461 Allow +/- in 2nd and later cells in a row, in 1st cell when td-attrs are present, or in 1st cell when there is a space between "|" and +/-
3462 !!input
3463 {|
3464 |-
3465 |style='color:red;'|+1
3466 |style='color:blue;'|-1
3467 |-
3468 | 1 || 2 || 3
3469 | 1 ||+2 ||-3
3470 |-
3471 | +1
3472 | -1
3473 |}
3474 !!result
3475 <table>
3476
3477 <tr>
3478 <td style="color:red;">+1
3479 </td>
3480 <td style="color:blue;">-1
3481 </td></tr>
3482 <tr>
3483 <td> 1 </td>
3484 <td> 2 </td>
3485 <td> 3
3486 </td>
3487 <td> 1 </td>
3488 <td>+2 </td>
3489 <td>-3
3490 </td></tr>
3491 <tr>
3492 <td> +1
3493 </td>
3494 <td> -1
3495 </td></tr></table>
3496
3497 !!end
3498
3499 !! test
3500 Table rowspan
3501 !! input
3502 {| border=1
3503 | Cell 1, row 1
3504 |rowspan=2| Cell 2, row 1 (and 2)
3505 | Cell 3, row 1
3506 |-
3507 | Cell 1, row 2
3508 | Cell 3, row 2
3509 |}
3510 !! result
3511 <table border="1">
3512 <tr>
3513 <td> Cell 1, row 1
3514 </td>
3515 <td rowspan="2"> Cell 2, row 1 (and 2)
3516 </td>
3517 <td> Cell 3, row 1
3518 </td></tr>
3519 <tr>
3520 <td> Cell 1, row 2
3521 </td>
3522 <td> Cell 3, row 2
3523 </td></tr></table>
3524
3525 !! end
3526
3527 !! test
3528 Nested table
3529 !! input
3530 {| border=1
3531 | &alpha;
3532 |
3533 {| bgcolor=#ABCDEF border=2
3534 |nested
3535 |-
3536 |table
3537 |}
3538 |the original table again
3539 |}
3540 !! result
3541 <table border="1">
3542 <tr>
3543 <td> &#945;
3544 </td>
3545 <td>
3546 <table bgcolor="#ABCDEF" border="2">
3547 <tr>
3548 <td>nested
3549 </td></tr>
3550 <tr>
3551 <td>table
3552 </td></tr></table>
3553 </td>
3554 <td>the original table again
3555 </td></tr></table>
3556
3557 !! end
3558
3559 !! test
3560 Invalid attributes in table cell (bug 1830)
3561 !! input
3562 {|
3563 |Cell:|broken
3564 |}
3565 !! result
3566 <table>
3567 <tr>
3568 <td>broken
3569 </td></tr></table>
3570
3571 !! end
3572
3573
3574 !! test
3575 Table security: embedded pipes (http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html)
3576 !! input
3577 {|
3578 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
3579 !! result
3580 <table>
3581 <tr>
3582 <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
3583 <td>]" onmouseover="alert(document.cookie)"&gt;test
3584 </td>
3585 </tr>
3586 </table>
3587
3588 !! end
3589
3590
3591 !! test
3592 Indented table markup mixed with indented pre content (proposed in bug 6200)
3593 !! input
3594 <table>
3595 <tr>
3596 <td>
3597 Text that should be rendered preformatted
3598 </td>
3599 </tr>
3600 </table>
3601 !! result
3602 <table>
3603 <tr>
3604 <td>
3605 <pre>Text that should be rendered preformatted
3606 </pre>
3607 </td>
3608 </tr>
3609 </table>
3610
3611 !! end
3612
3613 !! test
3614 Template-generated table cell attributes and cell content
3615 !! input
3616 {|
3617 |{{table_attribs}}
3618 |}
3619 !! result
3620 <table>
3621 <tr>
3622 <td style="color: red"> Foo
3623 </td></tr></table>
3624
3625 !! end
3626
3627 !! test
3628 Table with row followed by newlines and table heading
3629 !! input
3630 {|
3631 |-
3632
3633 ! foo
3634 |}
3635 !! result
3636 <table>
3637
3638
3639 <tr>
3640 <th> foo
3641 </th></tr></table>
3642
3643 !! end
3644
3645 !! test
3646 Table with empty line following the start tag
3647 !! input
3648 {|
3649
3650 |-
3651 | foo
3652 |}
3653 !! result
3654 <table>
3655
3656
3657 <tr>
3658 <td> foo
3659 </td></tr></table>
3660
3661 !! end
3662
3663 # FIXME: Preserve the attribute properly (with an empty string as value) in
3664 # the PHP parser. Parsoid implements the behavior below.
3665 !! test
3666 Table attributes with empty value
3667 !! options
3668 parsoid
3669 !! input
3670 {|
3671 | style=| hello
3672 |}
3673 !! result
3674 <table>
3675 <tr>
3676 <td style=""> hello
3677 </td></tr></table>
3678
3679 !! end
3680
3681 !! test
3682 Wikitext table with a lot of comments
3683 !! input
3684 {|
3685 <!-- c0 -->
3686 | foo
3687 <!-- c1 -->
3688 |- <!-- c2 -->
3689 <!-- c3 -->
3690 |<!-- c4 -->
3691 <!-- c5 -->
3692 |}
3693 !! result
3694 <table>
3695 <tr>
3696 <td> foo
3697 </td></tr>
3698 <tr>
3699 <td>
3700 </td></tr></table>
3701
3702 !! end
3703
3704 !! test
3705 Wikitext table with double-line table cell
3706 !! input
3707 {|
3708 |a
3709 b
3710 |}
3711 !! result
3712 <table>
3713 <tr>
3714 <td>a
3715 <p>b
3716 </p>
3717 </td></tr></table>
3718
3719 !! end
3720
3721 !! test
3722 Table cell with a single comment
3723 !! input
3724 {|
3725 | <!-- c1 -->
3726 | a
3727 |}
3728 !! result
3729 <table>
3730 <tr>
3731 <td>
3732 </td>
3733 <td> a
3734 </td></tr></table>
3735
3736 !! end
3737
3738 # The expected HTML structure in this test is debatable. The PHP parser does
3739 # not parse this kind of table at all. The main focus for Parsoid is on
3740 # round-tripping, so this output is ok for now. TODO: revisit!
3741 !! test
3742 Wikitext table with html-syntax row (Parsoid)
3743 !! options
3744 parsoid
3745 !! input
3746 {|
3747 |-
3748 <td>foo</td>
3749 |}
3750 !! result
3751 <table>
3752 <tbody>
3753 <tr>
3754 <td>foo</td></tr></tbody></table>
3755 !! end
3756
3757 ###
3758 ### Internal links
3759 ###
3760 !! test
3761 Plain link, capitalized
3762 !! input
3763 [[Main Page]]
3764 !! result
3765 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
3766 </p>
3767 !! end
3768
3769 !! test
3770 Plain link, uncapitalized
3771 !! input
3772 [[main Page]]
3773 !! result
3774 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
3775 </p>
3776 !! end
3777
3778 !! test
3779 Piped link
3780 !! input
3781 [[Main Page|The Main Page]]
3782 !! result
3783 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
3784 </p>
3785 !! end
3786
3787 !! test
3788 Broken link
3789 !! input
3790 [[Zigzagzogzagzig]]
3791 !! result
3792 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
3793 </p>
3794 !! end
3795
3796 !! test
3797 Broken link with fragment
3798 !! input
3799 [[Zigzagzogzagzig#zug]]
3800 !! result
3801 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
3802 </p>
3803 !! end
3804
3805 !! test
3806 Special page link with fragment
3807 !! input
3808 [[Special:Version#anchor]]
3809 !! result
3810 <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
3811 </p>
3812 !! end
3813
3814 !! test
3815 Nonexistent special page link with fragment
3816 !! input
3817 [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
3818 !! result
3819 <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
3820 </p>
3821 !! end
3822
3823 !! test
3824 Link with prefix
3825 !! input
3826 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
3827 !! result
3828 <p>xxx<a href="/wiki/Main_Page" title="Main Page">main Page</a>, xxx<a href="/wiki/Main_Page" title="Main Page">Main Page</a>, Xxx<a href="/wiki/Main_Page" title="Main Page">main Page</a> XXX<a href="/wiki/Main_Page" title="Main Page">main Page</a>, XXX<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
3829 </p>
3830 !! end
3831
3832 !! test
3833 Link with suffix
3834 !! input
3835 [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
3836 !! result
3837 <p><a href="/wiki/Main_Page" title="Main Page">Main Pagexxx</a>, <a href="/wiki/Main_Page" title="Main Page">Main Page</a>XXX, <a href="/wiki/Main_Page" title="Main Page">Main Page</a>!!!
3838 </p>
3839 !! end
3840
3841 !! article
3842 prefixed article
3843 !! text
3844 Some text
3845 !! endarticle
3846
3847 !! test
3848 Bug 43661: Piped links with identical prefixes
3849 !! input
3850 [[prefixed article|prefixed articles with spaces]]
3851
3852 [[prefixed article|prefixed articlesaoeu]]
3853
3854 [[Main Page|Main Page test]]
3855 !! result
3856 <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
3857 </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
3858 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
3859 </p>
3860 !! end
3861
3862
3863 !! test
3864 Link with HTML entity in suffix / tail
3865 !! input
3866 [[Main Page]]&quot;, [[Main Page]]&#97;
3867 !! result
3868 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>&quot;, <a href="/wiki/Main_Page" title="Main Page">Main Page</a>&#97;
3869 </p>
3870 !! end
3871
3872 !! test
3873 Link with 3 brackets
3874 !! input
3875 [[[main page]]]
3876 !! result
3877 <p>[[[main page]]]
3878 </p>
3879 !! end
3880
3881 !! test
3882 Piped link with 3 brackets
3883 !! input
3884 [[[main page|the main page]]]
3885 !! result
3886 <p>[[[main page|the main page]]]
3887 </p>
3888 !! end
3889
3890 !! test
3891 Link with multiple pipes
3892 !! input
3893 [[Main Page|The|Main|Page]]
3894 !! result
3895 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
3896 </p>
3897 !! end
3898
3899 !! test
3900 Link to namespaces
3901 !! input
3902 [[Talk:Parser testing]], [[Meta:Disclaimers]]
3903 !! result
3904 <p><a href="/index.php?title=Talk:Parser_testing&amp;action=edit&amp;redlink=1" class="new" title="Talk:Parser testing (page does not exist)">Talk:Parser testing</a>, <a href="/index.php?title=Meta:Disclaimers&amp;action=edit&amp;redlink=1" class="new" title="Meta:Disclaimers (page does not exist)">Meta:Disclaimers</a>
3905 </p>
3906 !! end
3907
3908 !! test
3909 Piped link to namespace
3910 !! input
3911 [[Meta:Disclaimers|The disclaimers]]
3912 !! result
3913 <p><a href="/index.php?title=Meta:Disclaimers&amp;action=edit&amp;redlink=1" class="new" title="Meta:Disclaimers (page does not exist)">The disclaimers</a>
3914 </p>
3915 !! end
3916
3917 !! test
3918 Link containing }
3919 !! input
3920 [[Usually caused by a typo (oops}]]
3921 !! result
3922 <p>[[Usually caused by a typo (oops}]]
3923 </p>
3924 !! end
3925
3926 !! test
3927 Link containing % (not as a hex sequence)
3928 !! input
3929 [[7% Solution]]
3930 !! result
3931 <p><a href="/index.php?title=7%25_Solution&amp;action=edit&amp;redlink=1" class="new" title="7% Solution (page does not exist)">7% Solution</a>
3932 </p>
3933 !! end
3934
3935 !! test
3936 Link containing % as a single hex sequence interpreted to char
3937 !! input
3938 [[7%25 Solution]]
3939 !! result
3940 <p><a href="/index.php?title=7%25_Solution&amp;action=edit&amp;redlink=1" class="new" title="7% Solution (page does not exist)">7% Solution</a>
3941 </p>
3942 !!end
3943
3944 !! test
3945 Link containing % as a double hex sequence interpreted to hex sequence
3946 !! input
3947 [[7%2525 Solution]]
3948 !! result
3949 <p>[[7%2525 Solution]]
3950 </p>
3951 !!end
3952
3953 !! test
3954 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
3955 Example for such a section: == < ==
3956 !! input
3957 [[%23%3c]][[%23%3e]]
3958 !! result
3959 <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
3960 </p>
3961 !! end
3962
3963 !! test
3964 Link containing "<#" and ">#" as a hex sequences
3965 !! input
3966 [[%3c%23]][[%3e%23]]
3967 !! result
3968 <p>[[%3c%23]][[%3e%23]]
3969 </p>
3970 !! end
3971
3972 !! test
3973 Link containing an equals sign
3974 !! input
3975 [[Special:BookSources/isbn=4-00-026157-6]]
3976 !! result
3977 <p><a href="/wiki/Special:BookSources/isbn%3D4-00-026157-6" title="Special:BookSources/isbn=4-00-026157-6">Special:BookSources/isbn=4-00-026157-6</a>
3978 </p>
3979 !! end
3980
3981 !! article
3982 Foo~bar
3983 !! text
3984 Just a test of an article title containing a tilde.
3985 !! endarticle
3986
3987 # note that links containing signatures, like [[Foo~~~~]], are
3988 # massaged by the pre-save transform (PST) and so the tildes are never
3989 # seen by the parser.
3990 !! test
3991 Link containing a tilde
3992 !! input
3993 [[Foo~bar]]
3994 !! result
3995 <p><a href="/wiki/Foo%7Ebar" title="Foo~bar">Foo~bar</a>
3996 </p>
3997 !! end
3998
3999 !! test
4000 Link containing double-single-quotes '' (bug 4598)
4001 !! input
4002 [[Lista d''e paise d''o munno]]
4003 !! result
4004 <p><a href="/index.php?title=Lista_d%27%27e_paise_d%27%27o_munno&amp;action=edit&amp;redlink=1" class="new" title="Lista d''e paise d''o munno (page does not exist)">Lista d''e paise d''o munno</a>
4005 </p>
4006 !! end
4007
4008 !! test
4009 Link containing double-single-quotes '' in text (bug 4598 sanity check)
4010 !! input
4011 Some [[Link|pretty ''italics'' and stuff]]!
4012 !! result
4013 <p>Some <a href="/index.php?title=Link&amp;action=edit&amp;redlink=1" class="new" title="Link (page does not exist)">pretty <i>italics</i> and stuff</a>!
4014 </p>
4015 !! end
4016
4017 !! test
4018 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
4019 !! input
4020 ''Some [[Link|pretty ''italics'' and stuff]]!
4021 !! result
4022 <p><i>Some <a href="/index.php?title=Link&amp;action=edit&amp;redlink=1" class="new" title="Link (page does not exist)">pretty <i>italics</i> and stuff</a>!</i>
4023 </p>
4024 !! end
4025
4026 !! test
4027 Link with double quotes in title part (literal) and alternate part (interpreted)
4028 !! input
4029 [[File:Denys Savchenko ''Pentecoste''.jpg]]
4030
4031 [[''Pentecoste'']]
4032
4033 [[''Pentecoste''|Pentecoste]]
4034
4035 [[''Pentecoste''|''Pentecoste'']]
4036 !! result
4037 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Denys_Savchenko_%27%27Pentecoste%27%27.jpg" class="new" title="File:Denys Savchenko &#39;&#39;Pentecoste&#39;&#39;.jpg">File:Denys Savchenko <i>Pentecoste</i>.jpg</a>
4038 </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="''Pentecoste'' (page does not exist)">''Pentecoste''</a>
4039 </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="''Pentecoste'' (page does not exist)">Pentecoste</a>
4040 </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="''Pentecoste'' (page does not exist)"><i>Pentecoste</i></a>
4041 </p>
4042 !! end
4043
4044 !! test
4045 Broken image links with HTML captions (bug 39700)
4046 !! input
4047 [[File:Nonexistent|<script></script>]]
4048 [[File:Nonexistent|100px|<script></script>]]
4049 [[File:Nonexistent|&lt;]]
4050 [[File:Nonexistent|a<i>b</i>c]]
4051 !! result
4052 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
4053 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
4054 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
4055 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
4056 </p>
4057 !! end
4058
4059 !! test
4060 Plain link to URL
4061 !! input
4062 [[http://www.example.com]]
4063 !! result
4064 <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
4065 </p>
4066 !! end
4067
4068 !! test
4069 Plain link to URL with link text
4070 !! input
4071 [[http://www.example.com Link text]]
4072 !! result
4073 <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
4074 </p>
4075 !! end
4076
4077 !! test
4078 Plain link to protocol-relative URL
4079 !! input
4080 [[//www.example.com]]
4081 !! result
4082 <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
4083 </p>
4084 !! end
4085
4086 !! test
4087 Plain link to protocol-relative URL with link text
4088 !! input
4089 [[//www.example.com Link text]]
4090 !! result
4091 <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
4092 </p>
4093 !! end
4094
4095 !! test
4096 Plain link to page with question mark in title
4097 !! input
4098 [[A?b]]
4099
4100 [[A?b|Baz]]
4101 !! result
4102 <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
4103 </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
4104 </p>
4105 !! end
4106
4107
4108 # I'm fairly sure the expected result here is wrong.
4109 # We want these to be URL links, not pseudo-pages with URLs for titles....
4110 # However the current output is also pretty screwy.
4111 #
4112 # ----
4113 # I'm changing it to match the current output--it arguably makes more
4114 # sense in the light of the test above. Old expected result was:
4115 #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
4116 #</p>
4117 # But I think this test is bordering on "garbage in, garbage out" anyway.
4118 # -- wtm
4119 !! test
4120 Piped link to URL
4121 !! input
4122 Piped link to URL: [[http://www.example.com|an example URL]]
4123 !! result
4124 <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
4125 </p>
4126 !! end
4127
4128 !! test
4129 BUG 2: [[page|http://url/]] should link to page, not http://url/
4130 !! input
4131 [[Main Page|http://url/]]
4132 !! result
4133 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
4134 </p>
4135 !! end
4136
4137 !! test
4138 BUG 337: Escaped self-links should be bold
4139 !! options
4140 title=[[Bug462]]
4141 !! input
4142 [[Bu&#103;462]] [[Bug462]]
4143 !! result
4144 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
4145 </p>
4146 !! end
4147
4148 !! test
4149 Self-link to section should not be bold
4150 !! options
4151 title=[[Main Page]]
4152 !! input
4153 [[Main Page#section]]
4154 !! result
4155 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
4156 </p>
4157 !! end
4158
4159 !! article
4160 00
4161 !! text
4162 This is 00.
4163 !! endarticle
4164
4165 !!test
4166 Self-link to numeric title
4167 !!options
4168 title=[[0]]
4169 !!input
4170 [[0]]
4171 !!result
4172 <p><strong class="selflink">0</strong>
4173 </p>
4174 !!end
4175
4176 !!test
4177 Link to numeric-equivalent title
4178 !!options
4179 title=[[0]]
4180 !!input
4181 [[00]]
4182 !!result
4183 <p><a href="/wiki/00" title="00">00</a>
4184 </p>
4185 !!end
4186
4187 !! test
4188 <nowiki> inside a link
4189 !! input
4190 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
4191 !! result
4192 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
4193 </p>
4194 !! end
4195
4196 !! test
4197 Non-breaking spaces in title
4198 !! input
4199 [[&nbsp; Main &nbsp; Page &nbsp;]]
4200 !! result
4201 <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
4202 </p>
4203 !!end
4204
4205 !! test
4206 Internal link with ca linktrail, surrounded by bold apostrophes (bug 27473 primary issue)
4207 !! options
4208 language=ca
4209 !! input
4210 '''[[Main Page]]'''
4211 !! result
4212 <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
4213 </p>
4214 !! end
4215
4216 !! test
4217 Internal link with ca linktrail, surrounded by italic apostrophes (bug 27473 primary issue)
4218 !! options
4219 language=ca
4220 !! input
4221 ''[[Main Page]]''
4222 !! result
4223 <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
4224 </p>
4225 !! end
4226
4227 !! test
4228 Internal link with en linktrail: no apostrophes (bug 27473)
4229 !! options
4230 language=en
4231 !! input
4232 [[Something]]'nice
4233 !! result
4234 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
4235 </p>
4236 !! end
4237
4238 !! test
4239 Internal link with ca linktrail with apostrophes (bug 27473)
4240 !! options
4241 language=ca
4242 !! input
4243 [[Something]]'nice
4244 !! result
4245 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
4246 </p>
4247 !! end
4248
4249 !! test
4250 Internal link with kaa linktrail with apostrophes (bug 27473)
4251 !! options
4252 language=kaa
4253 !! input
4254 [[Something]]'nice
4255 !! result
4256 <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (bet ele jaratılmag'an)">Something'nice</a>
4257 </p>
4258 !! end
4259
4260 !! article
4261 Söfnuður
4262 !! text
4263 Test.
4264 !! endarticle
4265
4266 !! test
4267 Internal link with is link prefix
4268 !! options
4269 language=is
4270 !! input
4271 Aðrir mótmælenda[[söfnuður|söfnuðir]] og
4272 !! result
4273 <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
4274 </p>
4275 !! end
4276
4277 !! article
4278 Mótmælendatrú
4279 !! text
4280 Test.
4281 !! endarticle
4282
4283 !! test
4284 Internal link with is link trail and link prefix
4285 !! options
4286 language=is
4287 !! input
4288 [[mótmælendatrú|xxx]]ar
4289 [[mótmælendatrú]]ar
4290 mótmælenda[[söfnuður]]
4291 mótmælenda[[söfnuður|söfnuðir]]
4292 mótmælenda[[söfnuður|söfnuðir]]xxx
4293 !! result
4294 <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
4295 <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
4296 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
4297 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
4298 <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
4299 </p>
4300 !! end
4301
4302 !! test
4303 Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
4304 !! input
4305 [[Foo| bar]]
4306
4307 [[Foo| ''bar'']]
4308
4309 [http://wp.org foo]
4310
4311 [http://wp.org ''foo'']
4312 !! result
4313 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)"> bar</a>
4314 </p><p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)"> <i>bar</i></a>
4315 </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
4316 </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
4317 </p>
4318 !! end
4319
4320 ###
4321 ### Interwiki links (see maintenance/interwiki.sql)
4322 ###
4323
4324 !! test
4325 Inline interwiki link
4326 !! input
4327 [[MeatBall:SoftSecurity]]
4328 !! result
4329 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
4330 </p>
4331 !! end
4332
4333 !! test
4334 Inline interwiki link with empty title (bug 2372)
4335 !! input
4336 [[MeatBall:]]
4337 !! result
4338 <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
4339 </p>
4340 !! end
4341
4342 !! test
4343 Interwiki link encoding conversion (bug 1636)
4344 !! input
4345 *[[Wikipedia:ro:Olteni&#0355;a]]
4346 *[[Wikipedia:ro:Olteni&#355;a]]
4347 !! result
4348 <ul><li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteni&#355;a</a>
4349 </li><li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteni&#355;a</a>
4350 </li></ul>
4351
4352 !! end
4353
4354 !! test
4355 Interwiki link with fragment (bug 2130)
4356 !! input
4357 [[MeatBall:SoftSecurity#foo]]
4358 !! result
4359 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
4360 </p>
4361 !! end
4362
4363 !! test
4364 Interlanguage link
4365 !! input
4366 Blah blah blah
4367 [[zh:Chinese]]
4368 !!result
4369 <p>Blah blah blah
4370 </p>
4371 !! end
4372
4373 !! test
4374 Double interlanguage link
4375 !! input
4376 Blah blah blah
4377 [[es:Spanish]]
4378 [[zh:Chinese]]
4379 !!result
4380 <p>Blah blah blah
4381 </p>
4382 !! end
4383
4384 !! test
4385 Interlanguage link, with prefix links
4386 !! options
4387 language=ln
4388 !! input
4389 Blah blah blah
4390 [[zh:Chinese]]
4391 !!result
4392 <p>Blah blah blah
4393 </p>
4394 !! end
4395
4396 !! test
4397 Double interlanguage link, with prefix links (bug 8897)
4398 !! options
4399 language=ln
4400 !! input
4401 Blah blah blah
4402 [[es:Spanish]]
4403 [[zh:Chinese]]
4404 !!result
4405 <p>Blah blah blah
4406 </p>
4407 !! end
4408
4409 !! test
4410 Parsoid-specific test: Wikilinks with &nbsp; should RT properly
4411 !! options
4412 language=ln
4413 !! input
4414 [[WW&nbsp;II]]
4415 !!result
4416 <p><a href="/index.php?title=WW_II&amp;action=edit&amp;redlink=1" class="new" title="WW II (lonkásá ezalí tɛ̂)">WW&#160;II</a>
4417 </p>
4418 !! end
4419
4420 ##
4421 ## XHTML tidiness
4422 ###
4423
4424 !! test
4425 <br> to <br />
4426 !! input
4427 1<br>2<br />3
4428 !! result
4429 <p>1<br />2<br />3
4430 </p>
4431 !! end
4432
4433 !! test
4434 Broken br tag sanitization
4435 !! input
4436 </br>
4437 !! result
4438 <p>&lt;/br&gt;
4439 </p>
4440 !! end
4441
4442 !! test
4443 Incorrecly removing closing slashes from correctly formed XHTML
4444 !! input
4445 <br style="clear:both;" />
4446 !! result
4447 <p><br style="clear:both;" />
4448 </p>
4449 !! end
4450
4451 !! test
4452 Failing to transform badly formed HTML into correct XHTML
4453 !! input
4454 <br style="clear: left;">
4455 <br style="clear: right;">
4456 <br style="clear: both;">
4457 !! result
4458 <p><br style="clear: left;" />
4459 <br style="clear: right;" />
4460 <br style="clear: both;" />
4461 </p>
4462 !!end
4463
4464 !! test
4465 Handling html with a div self-closing tag
4466 !! input
4467 <div title />
4468 <div title/>
4469 <div title/ >
4470 <div title=bar />
4471 <div title=bar/>
4472 <div title=bar/ >
4473 !! result
4474 <p>&lt;div title /&gt;
4475 &lt;div title/&gt;
4476 </p>
4477 <div>
4478 <p>&lt;div title=bar /&gt;
4479 &lt;div title=bar/&gt;
4480 </p>
4481 <div title="bar/"></div>
4482 </div>
4483
4484 !! end
4485
4486 !! test
4487 Handling html with a br self-closing tag
4488 !! input
4489 <br title />
4490 <br title/>
4491 <br title/ >
4492 <br title=bar />
4493 <br title=bar/>
4494 <br title=bar/ >
4495 !! result
4496 <p><br title="title" />
4497 <br title="title" />
4498 <br />
4499 <br title="bar" />
4500 <br title="bar" />
4501 <br title="bar/" />
4502 </p>
4503 !! end
4504
4505 !! test
4506 Horizontal ruler (should it add that extra space?)
4507 !! input
4508 <hr>
4509 <hr >
4510 foo <hr
4511 > bar
4512 !! result
4513 <hr />
4514 <hr />
4515 foo <hr /> bar
4516
4517 !! end
4518
4519 !! test
4520 Horizontal ruler -- 4+ dashes render hr
4521 !! input
4522 ----
4523 !! result
4524 <hr />
4525
4526 !! end
4527
4528 !! test
4529 Horizontal ruler -- eats additional dashes on the same line
4530 !! input
4531 ---------
4532 !! result
4533 <hr />
4534
4535 !! end
4536
4537 !! test
4538 Horizontal ruler -- does not collapse dashes on consecutive lines
4539 !! input
4540 ----
4541 ----
4542 !! result
4543 <hr />
4544 <hr />
4545
4546 !! end
4547
4548 !! test
4549 Horizontal ruler -- <4 dashes render as plain text
4550 !! input
4551 ---
4552 !! result
4553 <p>---
4554 </p>
4555 !! end
4556
4557 !! test
4558 Horizontal ruler -- Supports content following dashes on same line
4559 !! input
4560 ---- Foo
4561 !! result
4562 <hr /> Foo
4563
4564 !! end
4565
4566 ###
4567 ### Block-level elements
4568 ###
4569 !! test
4570 Common list
4571 !! input
4572 *Common list
4573 * item 2
4574 *item 3
4575 !! result
4576 <ul><li>Common list
4577 </li><li> item 2
4578 </li><li>item 3
4579 </li></ul>
4580
4581 !! end
4582
4583 !! test
4584 Numbered list
4585 !! input
4586 #Numbered list
4587 #item 2
4588 # item 3
4589 !! result
4590 <ol><li>Numbered list
4591 </li><li>item 2
4592 </li><li> item 3
4593 </li></ol>
4594
4595 !! end
4596
4597 !! test
4598 Mixed list
4599 !! input
4600 *Mixed list
4601 *# with numbers
4602 ** and bullets
4603 *# and numbers
4604 *bullets again
4605 **bullet level 2
4606 ***bullet level 3
4607 ***#Number on level 4
4608 **bullet level 2
4609 **#Number on level 3
4610 **#Number on level 3
4611 *#number level 2
4612 *Level 1
4613 *** Level 3
4614 #** Level 3, but ordered
4615 !! result
4616 <ul><li>Mixed list
4617 <ol><li> with numbers
4618 </li></ol>
4619 <ul><li> and bullets
4620 </li></ul>
4621 <ol><li> and numbers
4622 </li></ol>
4623 </li><li>bullets again
4624 <ul><li>bullet level 2
4625 <ul><li>bullet level 3
4626 <ol><li>Number on level 4
4627 </li></ol>
4628 </li></ul>
4629 </li><li>bullet level 2
4630 <ol><li>Number on level 3
4631 </li><li>Number on level 3
4632 </li></ol>
4633 </li></ul>
4634 <ol><li>number level 2
4635 </li></ol>
4636 </li><li>Level 1
4637 <ul><li><ul><li> Level 3
4638 </li></ul>
4639 </li></ul>
4640 </li></ul>
4641 <ol><li><ul><li><ul><li> Level 3, but ordered
4642 </li></ul>
4643 </li></ul>
4644 </li></ol>
4645
4646 !! end
4647
4648 !! test
4649 Nested lists 1
4650 !! input
4651 *foo
4652 **bar
4653 !! result
4654 <ul><li>foo
4655 <ul><li>bar
4656 </li></ul>
4657 </li></ul>
4658
4659 !! end
4660
4661 !! test
4662 Nested lists 2
4663 !! input
4664 **foo
4665 *bar
4666 !! result
4667 <ul><li><ul><li>foo
4668 </li></ul>
4669 </li><li>bar
4670 </li></ul>
4671
4672 !! end
4673
4674 !! test
4675 Nested lists 3 (first element empty)
4676 !! input
4677 *
4678 **bar
4679 !! result
4680 <ul><li>
4681 <ul><li>bar
4682 </li></ul>
4683 </li></ul>
4684
4685 !! end
4686
4687 !! test
4688 Nested lists 4 (first element empty)
4689 !! input
4690 **
4691 *bar
4692 !! result
4693 <ul><li><ul><li>
4694 </li></ul>
4695 </li><li>bar
4696 </li></ul>
4697
4698 !! end
4699
4700 !! test
4701 Nested lists 5 (both elements empty)
4702 !! input
4703 **
4704 *
4705 !! result
4706 <ul><li><ul><li>
4707 </li></ul>
4708 </li><li>
4709 </li></ul>
4710
4711 !! end
4712
4713 !! test
4714 Nested lists 6 (both elements empty)
4715 !! input
4716 *
4717 **
4718 !! result
4719 <ul><li>
4720 <ul><li>
4721 </li></ul>
4722 </li></ul>
4723
4724 !! end
4725
4726 !! test
4727 Nested lists 7 (skip initial nesting levels)
4728 !! input
4729 *** foo
4730 !! result
4731 <ul><li><ul><li><ul><li> foo
4732 </li></ul>
4733 </li></ul>
4734 </li></ul>
4735
4736 !! end
4737
4738 !! test
4739 Nested lists 8 (multiple nesting transitions)
4740 !! input
4741 * foo
4742 *** bar
4743 ** baz
4744 * boo
4745 !! result
4746 <ul><li> foo
4747 <ul><li><ul><li> bar
4748 </li></ul>
4749 </li><li> baz
4750 </li></ul>
4751 </li><li> boo
4752 </li></ul>
4753
4754 !! end
4755
4756 !! test
4757 1. Lists with start-of-line-transparent tokens before bullets: Comments
4758 !! input
4759 *foo
4760 *<!--cmt-->bar
4761 <!--cmt-->*baz
4762 !! result
4763 <ul><li>foo
4764 </li><li>bar
4765 </li><li>baz
4766 </li></ul>
4767
4768 !! end
4769
4770 !! test
4771 2. Lists with start-of-line-transparent tokens before bullets: Template close
4772 !! input
4773 *foo {{echo|bar
4774 }}*baz
4775 !! result
4776 <ul><li>foo bar
4777 </li><li>baz
4778 </li></ul>
4779
4780 !! end
4781
4782 !! test
4783 Unbalanced closing block tags break a list
4784 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
4785 !! options
4786 parsoid
4787 !! input
4788 <div>
4789 *a</div><div>
4790 *b</div>
4791 !! result
4792 <div>
4793 <ul><li>a
4794 </li></ul></div><div>
4795 <ul><li>b
4796 </li></ul></div>
4797 !! end
4798
4799 !! test
4800 Unbalanced closing non-block tags don't break a list
4801 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
4802 !! options
4803 parsoid
4804 !! input
4805 <span>
4806 *a</span><span>
4807 *b</span>
4808 !! result
4809 <p><span></span>
4810 </p>
4811 <ul><li>a<span></span>
4812 </li><li>b
4813 </li></ul>
4814 !! end
4815
4816 !! test
4817 Unclosed formatting tags that straddle lists are closed and reopened
4818 (Parsoid-only since php parser generates broken html -- relies on Tidy to fix up)
4819 !! options
4820 parsoid
4821 !! input
4822 # <s> a
4823 # b </s>
4824 !! result
4825 <ol><li> <s> a </s>
4826 </li><li> <s> b </s>
4827 </li></ol>
4828 !! end
4829
4830 !!test
4831 List embedded in a non-block tag
4832 (Ugly Parsoid output -- worth fixing; Disabled for PHP parser since it relies on Tidy)
4833 !! options
4834 parsoid
4835 !!input
4836 <small>
4837 * foo
4838 </small>
4839 !!result
4840 <p><small></small></p>
4841 <small>
4842 <ul>
4843 <li> foo</li>
4844 </ul>
4845 </small>
4846 <p><small></small></p>
4847 !!end
4848
4849 !! test
4850 List items are not parsed correctly following a <pre> block (bug 785)
4851 !! input
4852 * <pre>foo</pre>
4853 * <pre>bar</pre>
4854 * zar
4855 !! result
4856 <ul><li> <pre>foo</pre>
4857 </li><li> <pre>bar</pre>
4858 </li><li> zar
4859 </li></ul>
4860
4861 !! end
4862
4863 !! test
4864 List items from template
4865 !! input
4866
4867 {{inner list}}
4868 * item 2
4869
4870 * item 0
4871 {{inner list}}
4872 * item 2
4873
4874 * item 0
4875 * notSOL{{inner list}}
4876 * item 2
4877 !! result
4878 <ul><li> item 1
4879 </li><li> item 2
4880 </li></ul>
4881 <ul><li> item 0
4882 </li><li> item 1
4883 </li><li> item 2
4884 </li></ul>
4885 <ul><li> item 0
4886 </li><li> notSOL
4887 </li><li> item 1
4888 </li><li> item 2
4889 </li></ul>
4890
4891 !! end
4892
4893 !! test
4894 List interrupted by empty line or heading
4895 !! input
4896 * foo
4897
4898 ** bar
4899 == A heading ==
4900 * Another list item
4901 !! result
4902 <ul><li> foo
4903 </li></ul>
4904 <ul><li><ul><li> bar
4905 </li></ul>
4906 </li></ul>
4907 <h2><span class="mw-headline" id="A_heading">A heading</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: A heading">edit</a>]</span></h2>
4908 <ul><li> Another list item
4909 </li></ul>
4910
4911 !!end
4912
4913 !!test
4914 Multiple list tags generated by templates
4915 !!input
4916 {{echo|<li>}}a
4917 {{echo|<li>}}b
4918 {{echo|<li>}}c
4919 !!result
4920 <li>a
4921 <li>b
4922 <li>c</li>
4923 </li>
4924 </li>
4925
4926 !!end
4927
4928 !!test
4929 Single-comment whitespace lines dont break lists, but multi-comment whitespace lines do
4930 !!input
4931 *a
4932 <!--This line will NOT split the list-->
4933 *b
4934 <!--This line will NOT split the list either-->
4935 *c
4936 <!--foo--> <!--This line with more than 1 comment will split the list-->
4937 *d
4938 !!result
4939 <ul><li>a
4940 </li><li>b
4941 </li><li>c
4942 </li></ul>
4943 <ul><li>d
4944 </li></ul>
4945
4946 !!end
4947
4948 ###
4949 ### Magic Words
4950 ###
4951
4952 !! test
4953 Magic Word: {{CURRENTDAY}}
4954 !! input
4955 {{CURRENTDAY}}
4956 !! result
4957 <p>1
4958 </p>
4959 !! end
4960
4961 !! test
4962 Magic Word: {{CURRENTDAY2}}
4963 !! input
4964 {{CURRENTDAY2}}
4965 !! result
4966 <p>01
4967 </p>
4968 !! end
4969
4970 !! test
4971 Magic Word: {{CURRENTDAYNAME}}
4972 !! input
4973 {{CURRENTDAYNAME}}
4974 !! result
4975 <p>Thursday
4976 </p>
4977 !! end
4978
4979 !! test
4980 Magic Word: {{CURRENTDOW}}
4981 !! input
4982 {{CURRENTDOW}}
4983 !! result
4984 <p>4
4985 </p>
4986 !! end
4987
4988 !! test
4989 Magic Word: {{CURRENTMONTH}}
4990 !! input
4991 {{CURRENTMONTH}}
4992 !! result
4993 <p>01
4994 </p>
4995 !! end
4996
4997 !! test
4998 Magic Word: {{CURRENTMONTHABBREV}}
4999 !! input
5000 {{CURRENTMONTHABBREV}}
5001 !! result
5002 <p>Jan
5003 </p>
5004 !! end
5005
5006 !! test
5007 Magic Word: {{CURRENTMONTHNAME}}
5008 !! input
5009 {{CURRENTMONTHNAME}}
5010 !! result
5011 <p>January
5012 </p>
5013 !! end
5014
5015 !! test
5016 Magic Word: {{CURRENTMONTHNAMEGEN}}
5017 !! input
5018 {{CURRENTMONTHNAMEGEN}}
5019 !! result
5020 <p>January
5021 </p>
5022 !! end
5023
5024 !! test
5025 Magic Word: {{CURRENTTIME}}
5026 !! input
5027 {{CURRENTTIME}}
5028 !! result
5029 <p>00:02
5030 </p>
5031 !! end
5032
5033 !! test
5034 Magic Word: {{CURRENTWEEK}} (@bug 4594)
5035 !! input
5036 {{CURRENTWEEK}}
5037 !! result
5038 <p>1
5039 </p>
5040 !! end
5041
5042 !! test
5043 Magic Word: {{CURRENTYEAR}}
5044 !! input
5045 {{CURRENTYEAR}}
5046 !! result
5047 <p>1970
5048 </p>
5049 !! end
5050
5051 !! test
5052 Magic Word: {{FULLPAGENAME}}
5053 !! options
5054 title=[[User:Ævar Arnfjörð Bjarmason]]
5055 !! input
5056 {{FULLPAGENAME}}
5057 !! result
5058 <p>User:Ævar Arnfjörð Bjarmason
5059 </p>
5060 !! end
5061
5062 !! test
5063 Magic Word: {{FULLPAGENAMEE}}
5064 !! options
5065 title=[[User:Ævar Arnfjörð Bjarmason]]
5066 !! input
5067 {{FULLPAGENAMEE}}
5068 !! result
5069 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
5070 </p>
5071 !! end
5072
5073 !! test
5074 Magic Word: {{NAMESPACE}}
5075 !! options
5076 title=[[User:Ævar Arnfjörð Bjarmason]]
5077 !! input
5078 {{NAMESPACE}}
5079 !! result
5080 <p>User
5081 </p>
5082 !! end
5083
5084 !! test
5085 Magic Word: {{NAMESPACEE}}
5086 !! options
5087 title=[[User:Ævar Arnfjörð Bjarmason]]
5088 !! input
5089 {{NAMESPACEE}}
5090 !! result
5091 <p>User
5092 </p>
5093 !! end
5094
5095 !! test
5096 Magic Word: {{NAMESPACENUMBER}}
5097 !! options
5098 title=[[User:Ævar Arnfjörð Bjarmason]]
5099 !! input
5100 {{NAMESPACENUMBER}}
5101 !! result
5102 <p>2
5103 </p>
5104 !! end
5105
5106 !! test
5107 Magic Word: {{NUMBEROFFILES}}
5108 !! input
5109 {{NUMBEROFFILES}}
5110 !! result
5111 <p>3
5112 </p>
5113 !! end
5114
5115 !! test
5116 Magic Word: {{PAGENAME}}
5117 !! options
5118 title=[[User:Ævar Arnfjörð Bjarmason]]
5119 !! input
5120 {{PAGENAME}}
5121 !! result
5122 <p>Ævar Arnfjörð Bjarmason
5123 </p>
5124 !! end
5125
5126 !! test
5127 Magic Word: {{PAGENAME}} with metacharacters
5128 !! options
5129 title=[['foo & bar = baz']]
5130 !! input
5131 ''{{PAGENAME}}''
5132 !! result
5133 <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
5134 </p>
5135 !! end
5136
5137 !! test
5138 Magic Word: {{PAGENAME}} with metacharacters (bug 26781)
5139 !! options
5140 title=[[*RFC 1234 http://example.com/]]
5141 !! input
5142 {{PAGENAME}}
5143 !! result
5144 <p>&#42;RFC&#32;1234 http&#58;//example.com/
5145 </p>
5146 !! end
5147
5148 !! test
5149 Magic Word: {{PAGENAMEE}}
5150 !! options
5151 title=[[User:Ævar Arnfjörð Bjarmason]]
5152 !! input
5153 {{PAGENAMEE}}
5154 !! result
5155 <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
5156 </p>
5157 !! end
5158
5159 !! test
5160 Magic Word: {{PAGENAMEE}} with metacharacters (bug 26781)
5161 !! options
5162 title=[[*RFC 1234 http://example.com/]]
5163 !! input
5164 {{PAGENAMEE}}
5165 !! result
5166 <p>&#42;RFC_1234_http&#58;//example.com/
5167 </p>
5168 !! end
5169
5170 !! test
5171 Magic Word: {{REVISIONID}}
5172 !! input
5173 {{REVISIONID}}
5174 !! result
5175 <p>1337
5176 </p>
5177 !! end
5178
5179 !! test
5180 Magic Word: {{SCRIPTPATH}}
5181 !! input
5182 {{SCRIPTPATH}}
5183 !! result
5184 <p>/
5185 </p>
5186 !! end
5187
5188 !! test
5189 Magic Word: {{SERVER}}
5190 !! input
5191 {{SERVER}}
5192 !! result
5193 <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
5194 </p>
5195 !! end
5196
5197 !! test
5198 Magic Word: {{SERVERNAME}}
5199 !! input
5200 {{SERVERNAME}}
5201 !! result
5202 <p>example.org
5203 </p>
5204 !! end
5205
5206 !! test
5207 Magic Word: {{SITENAME}}
5208 !! input
5209 {{SITENAME}}
5210 !! result
5211 <p>MediaWiki
5212 </p>
5213 !! end
5214
5215 !! test
5216 Case-sensitive magic words, when cased differently, should just be template transclusions
5217 !! input
5218 {{CurrentMonth}}
5219 {{currentday}}
5220 {{cURreNTweEK}}
5221 {{currentHour}}
5222 !! result
5223 <p><a href="/index.php?title=Template:CurrentMonth&amp;action=edit&amp;redlink=1" class="new" title="Template:CurrentMonth (page does not exist)">Template:CurrentMonth</a>
5224 <a href="/index.php?title=Template:Currentday&amp;action=edit&amp;redlink=1" class="new" title="Template:Currentday (page does not exist)">Template:Currentday</a>
5225 <a href="/index.php?title=Template:CURreNTweEK&amp;action=edit&amp;redlink=1" class="new" title="Template:CURreNTweEK (page does not exist)">Template:CURreNTweEK</a>
5226 <a href="/index.php?title=Template:CurrentHour&amp;action=edit&amp;redlink=1" class="new" title="Template:CurrentHour (page does not exist)">Template:CurrentHour</a>
5227 </p>
5228 !! end
5229
5230 !! test
5231 Case-insensitive magic words should still work with weird casing.
5232 !! input
5233 {{sErVeRNaMe}}
5234 {{LCFirst:AOEU}}
5235 {{ucFIRST:aoeu}}
5236 {{SERver}}
5237 !! result
5238 <p>example.org
5239 aOEU
5240 Aoeu
5241 <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
5242 </p>
5243 !! end
5244
5245 !! test
5246 Namespace 1 {{ns:1}}
5247 !! input
5248 {{ns:1}}
5249 !! result
5250 <p>Talk
5251 </p>
5252 !! end
5253
5254 !! test
5255 Namespace 1 {{ns:01}}
5256 !! input
5257 {{ns:01}}
5258 !! result
5259 <p>Talk
5260 </p>
5261 !! end
5262
5263 !! test
5264 Namespace 0 {{ns:0}} (bug 4783)
5265 !! input
5266 {{ns:0}}
5267 !! result
5268
5269 !! end
5270
5271 !! test
5272 Namespace 0 {{ns:00}} (bug 4783)
5273 !! input
5274 {{ns:00}}
5275 !! result
5276
5277 !! end
5278
5279 !! test
5280 Namespace -1 {{ns:-1}}
5281 !! input
5282 {{ns:-1}}
5283 !! result
5284 <p>Special
5285 </p>
5286 !! end
5287
5288 !! test
5289 Namespace User {{ns:User}}
5290 !! input
5291 {{ns:User}}
5292 !! result
5293 <p>User
5294 </p>
5295 !! end
5296
5297 !! test
5298 Namespace User talk {{ns:User_talk}}
5299 !! input
5300 {{ns:User_talk}}
5301 !! result
5302 <p>User talk
5303 </p>
5304 !! end
5305
5306 !! test
5307 Namespace User talk {{ns:uSeR tAlK}}
5308 !! input
5309 {{ns:uSeR tAlK}}
5310 !! result
5311 <p>User talk
5312 </p>
5313 !! end
5314
5315 !! test
5316 Namespace File {{ns:File}}
5317 !! input
5318 {{ns:File}}
5319 !! result
5320 <p>File
5321 </p>
5322 !! end
5323
5324 !! test
5325 Namespace File {{ns:Image}}
5326 !! input
5327 {{ns:Image}}
5328 !! result
5329 <p>File
5330 </p>
5331 !! end
5332
5333 !! test
5334 Namespace (lang=de) Benutzer {{ns:User}}
5335 !! options
5336 language=de
5337 !! input
5338 {{ns:User}}
5339 !! result
5340 <p>Benutzer
5341 </p>
5342 !! end
5343
5344 !! test
5345 Namespace (lang=de) Benutzer Diskussion {{ns:3}}
5346 !! options
5347 language=de
5348 !! input
5349 {{ns:3}}
5350 !! result
5351 <p>Benutzer Diskussion
5352 </p>
5353 !! end
5354
5355
5356 !! test
5357 Urlencode
5358 !! input
5359 {{urlencode:hi world?!}}
5360 {{urlencode:hi world?!|WIKI}}
5361 {{urlencode:hi world?!|PATH}}
5362 {{urlencode:hi world?!|QUERY}}
5363 !! result
5364 <p>hi+world%3F%21
5365 hi_world%3F!
5366 hi%20world%3F%21
5367 hi+world%3F%21
5368 </p>
5369 !! end
5370
5371 ###
5372 ### Magic links
5373 ###
5374 !! test
5375 Magic links: internal link to RFC (bug 479)
5376 !! input
5377 [[RFC 123]]
5378 !! result
5379 <p><a href="/index.php?title=RFC_123&amp;action=edit&amp;redlink=1" class="new" title="RFC 123 (page does not exist)">RFC 123</a>
5380 </p>
5381 !! end
5382
5383 !! test
5384 Magic links: RFC (bug 479)
5385 !! input
5386 RFC 822
5387 !! result
5388 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc822">RFC 822</a>
5389 </p>
5390 !! end
5391
5392 !! test
5393 Magic links: ISBN (bug 1937)
5394 !! input
5395 ISBN 0-306-40615-2
5396 !! result
5397 <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
5398 </p>
5399 !! end
5400
5401 !! test
5402 Magic links: PMID incorrectly converts space to underscore
5403 !! input
5404 PMID 1234
5405 !! result
5406 <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
5407 </p>
5408 !! end
5409
5410 ###
5411 ### Templates
5412 ####
5413
5414 !! test
5415 Nonexistent template
5416 !! input
5417 {{thistemplatedoesnotexist}}
5418 !! result
5419 <p><a href="/index.php?title=Template:Thistemplatedoesnotexist&amp;action=edit&amp;redlink=1" class="new" title="Template:Thistemplatedoesnotexist (page does not exist)">Template:Thistemplatedoesnotexist</a>
5420 </p>
5421 !! end
5422
5423 !! test
5424 Template with invalid target containing tags
5425 !! input
5426 {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
5427 !! result
5428 <p>{{a<b>b</b>|foo|a=b|a = b}}
5429 </p>
5430 !! end
5431
5432 !! test
5433 Template with invalid target containing unclosed tag
5434 !! input
5435 {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
5436 !! result
5437 <p>{{a<b>|foo|a=b|a = b}}</b>
5438 </p>
5439 !! end
5440
5441 !! article
5442 Template:test
5443 !! text
5444 This is a test template
5445 !! endarticle
5446
5447 !! test
5448 Simple template
5449 !! input
5450 {{test}}
5451 !! result
5452 <p>This is a test template
5453 </p>
5454 !! end
5455
5456 !! test
5457 Template with explicit namespace
5458 !! input
5459 {{Template:test}}
5460 !! result
5461 <p>This is a test template
5462 </p>
5463 !! end
5464
5465
5466 !! article
5467 Template:paramtest
5468 !! text
5469 This is a test template with parameter {{{param}}}
5470 !! endarticle
5471
5472 !! test
5473 Template parameter
5474 !! input
5475 {{paramtest|param=foo}}
5476 !! result
5477 <p>This is a test template with parameter foo
5478 </p>
5479 !! end
5480
5481 !! article
5482 Template:paramtestnum
5483 !! text
5484 [[{{{1}}}|{{{2}}}]]
5485 !! endarticle
5486
5487 !! test
5488 Template unnamed parameter
5489 !! input
5490 {{paramtestnum|Main Page|the main page}}
5491 !! result
5492 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
5493 </p>
5494 !! end
5495
5496 !! article
5497 Template:templatesimple
5498 !! text
5499 (test)
5500 !! endarticle
5501
5502 !! article
5503 Template:templateredirect
5504 !! text
5505 #redirect [[Template:templatesimple]]
5506 !! endarticle
5507
5508 !! article
5509 Template:templateasargtestnum
5510 !! text
5511 {{{{{1}}}}}
5512 !! endarticle
5513
5514 !! article
5515 Template:templateasargtest
5516 !! text
5517 {{template{{{templ}}}}}
5518 !! endarticle
5519
5520 !! article
5521 Template:templateasargtest2
5522 !! text
5523 {{{{{templ}}}}}
5524 !! endarticle
5525
5526 !! test
5527 Template with template name as unnamed argument
5528 !! input
5529 {{templateasargtestnum|templatesimple}}
5530 !! result
5531 <p>(test)
5532 </p>
5533 !! end
5534
5535 !! test
5536 Template with template name as argument
5537 !! input
5538 {{templateasargtest|templ=simple}}
5539 !! result
5540 <p>(test)
5541 </p>
5542 !! end
5543
5544 !! test
5545 Template with template name as argument (2)
5546 !! input
5547 {{templateasargtest2|templ=templatesimple}}
5548 !! result
5549 <p>(test)
5550 </p>
5551 !! end
5552
5553 !! article
5554 Template:templateasargtestdefault
5555 !! text
5556 {{{{{templ|templatesimple}}}}}
5557 !! endarticle
5558
5559 !! article
5560 Template:templa
5561 !! text
5562 '''templ'''
5563 !! endarticle
5564
5565 !! test
5566 Template with default value
5567 !! input
5568 {{templateasargtestdefault}}
5569 !! result
5570 <p>(test)
5571 </p>
5572 !! end
5573
5574 !! test
5575 Template with default value (value set)
5576 !! input
5577 {{templateasargtestdefault|templ=templa}}
5578 !! result
5579 <p><b>templ</b>
5580 </p>
5581 !! end
5582
5583 !! test
5584 Template redirect
5585 !! input
5586 {{templateredirect}}
5587 !! result
5588 <p>(test)
5589 </p>
5590 !! end
5591
5592 !! test
5593 Template with argument in separate line
5594 !! input
5595 {{ templateasargtest |
5596 templ = simple }}
5597 !! result
5598 <p>(test)
5599 </p>
5600 !! end
5601
5602 !! test
5603 Template with complex template as argument
5604 !! input
5605 {{paramtest|
5606 param ={{ templateasargtest |
5607 templ = simple }}}}
5608 !! result
5609 <p>This is a test template with parameter (test)
5610 </p>
5611 !! end
5612
5613 !! test
5614 Template with thumb image (with link in description)
5615 !! input
5616 {{paramtest|
5617 param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
5618 !! result
5619 This is a test template with parameter <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/index.php?title=Special:Upload&amp;wpDestFile=Noimage.png" class="new" title="File:Noimage.png">File:Noimage.png</a> <div class="thumbcaption"><a href="/index.php?title=No_link&amp;action=edit&amp;redlink=1" class="new" title="No link (page does not exist)">link</a> <a href="/index.php?title=No_link&amp;action=edit&amp;redlink=1" class="new" title="No link (page does not exist)">caption</a></div></div></div>
5620
5621 !! end
5622
5623 !! article
5624 Template:complextemplate
5625 !! text
5626 {{{1}}} {{paramtest|
5627 param ={{{param}}}}}
5628 !! endarticle
5629
5630 !! test
5631 Template with complex arguments
5632 !! input
5633 {{complextemplate|
5634 param ={{ templateasargtest |
5635 templ = simple }}|[[Template:complextemplate|link]]}}
5636 !! result
5637 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
5638 </p>
5639 !! end
5640
5641 !! test
5642 BUG 553: link with two variables in a piped link
5643 !! input
5644 {|
5645 |[[{{{1}}}|{{{2}}}]]
5646 |}
5647 !! result
5648 <table>
5649 <tr>
5650 <td>[[{{{1}}}|{{{2}}}]]
5651 </td></tr></table>
5652
5653 !! end
5654
5655 !! test
5656 Magic variable as template parameter
5657 !! input
5658 {{paramtest|param={{SITENAME}}}}
5659 !! result
5660 <p>This is a test template with parameter MediaWiki
5661 </p>
5662 !! end
5663
5664 !! article
5665 Template:linktest
5666 !! text
5667 [[{{{param}}}|link]]
5668 !! endarticle
5669
5670 !! test
5671 Template parameter as link source
5672 !! input
5673 {{linktest|param=Main Page}}
5674 !! result
5675 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
5676 </p>
5677 !! end
5678
5679 !!test
5680 Template-generated attribute string (k='v')
5681 !!input
5682 <span {{attr_str|id|v1}}>bar</span>
5683 !!result
5684 <p><span id="v1">bar</span>
5685 </p>
5686 !!end
5687
5688 !!article
5689 Template:paramtest2
5690 !! text
5691 including another template, {{paramtest|param={{{arg}}}}}
5692 !! endarticle
5693
5694 !! test
5695 Template passing argument to another template
5696 !! input
5697 {{paramtest2|arg='hmm'}}
5698 !! result
5699 <p>including another template, This is a test template with parameter 'hmm'
5700 </p>
5701 !! end
5702
5703 !! article
5704 Template:Linktest2
5705 !! text
5706 Main Page
5707 !! endarticle
5708
5709 !! test
5710 Template as link source
5711 !! input
5712 [[{{linktest2}}]]
5713
5714 [[{{linktest2}}|Main Page]]
5715
5716 [[{{linktest2}}]]Page
5717 !! result
5718 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
5719 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
5720 </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
5721 </p>
5722 !! end
5723
5724
5725 !! article
5726 Template:loop1
5727 !! text
5728 {{loop2}}
5729 !! endarticle
5730
5731 !! article
5732 Template:loop2
5733 !! text
5734 {{loop1}}
5735 !! endarticle
5736
5737 !! test
5738 Template infinite loop
5739 !! input
5740 {{loop1}}
5741 !! result
5742 <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
5743 </p>
5744 !! end
5745
5746 !! test
5747 Template from main namespace
5748 !! input
5749 {{:Main Page}}
5750 !! result
5751 <p>blah blah
5752 </p>
5753 !! end
5754
5755 !! article
5756 Template:table
5757 !! text
5758 {|
5759 | 1 || 2
5760 |-
5761 | 3 || 4
5762 |}
5763 !! endarticle
5764
5765 !! test
5766 BUG 529: Template with table, not included at beginning of line
5767 !! input
5768 foo {{table}}
5769 !! result
5770 <p>foo
5771 </p>
5772 <table>
5773 <tr>
5774 <td> 1 </td>
5775 <td> 2
5776 </td></tr>
5777 <tr>
5778 <td> 3 </td>
5779 <td> 4
5780 </td></tr></table>
5781
5782 !! end
5783
5784 !! test
5785 BUG 523: Template shouldn't eat newline (or add an extra one before table)
5786 !! input
5787 foo
5788 {{table}}
5789 !! result
5790 <p>foo
5791 </p>
5792 <table>
5793 <tr>
5794 <td> 1 </td>
5795 <td> 2
5796 </td></tr>
5797 <tr>
5798 <td> 3 </td>
5799 <td> 4
5800 </td></tr></table>
5801
5802 !! end
5803
5804 !! test
5805 BUG 41: Template parameters shown as broken links
5806 !! input
5807 {{{parameter}}}
5808 !! result
5809 <p>{{{parameter}}}
5810 </p>
5811 !! end
5812
5813 !! test
5814 Template with targets containing wikilinks
5815 !! input
5816 {{[[foo]]}}
5817
5818 {{[[{{echo|foo}}]]}}
5819
5820 {{{{echo|[[foo}}]]}}
5821 !! result
5822 <p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
5823 </p><p>{{<a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">foo</a>}}
5824 </p><p>{{[[foo}}]]
5825 </p>
5826 !! end
5827
5828 !! article
5829 Template:MSGNW test
5830 !! text
5831 ''None'' of '''this''' should be
5832 * interpreted
5833 but rather passed unmodified
5834 {{test}}
5835 !! endarticle
5836
5837 # hmm, fix this or just deprecate msgnw and document its behavior?
5838 !! test
5839 msgnw keyword
5840 !! options
5841 disabled
5842 !! input
5843 {{msgnw:MSGNW test}}
5844 !! result
5845 <p>''None'' of '''this''' should be
5846 * interpreted
5847 but rather passed unmodified
5848 {{test}}
5849 </p>
5850 !! end
5851
5852 !! test
5853 int keyword
5854 !! input
5855 {{int:youhavenewmessages|lots of money|not!}}
5856 !! result
5857 <p>You have lots of money (not!).
5858 </p>
5859 !! end
5860
5861 !! article
5862 Template:Includes
5863 !! text
5864 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
5865 !! endarticle
5866
5867 !! test
5868 <includeonly> and <noinclude> being included
5869 !! input
5870 {{Includes}}
5871 !! result
5872 <p>Foobar
5873 </p>
5874 !! end
5875
5876 !! article
5877 Template:Includes2
5878 !! text
5879 <onlyinclude>Foo</onlyinclude>bar
5880 !! endarticle
5881
5882 !! test
5883 <onlyinclude> being included
5884 !! input
5885 {{Includes2}}
5886 !! result
5887 <p>Foo
5888 </p>
5889 !! end
5890
5891
5892 !! article
5893 Template:Includes3
5894 !! text
5895 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
5896 !! endarticle
5897
5898 !! test
5899 <onlyinclude> and <includeonly> being included
5900 !! input
5901 {{Includes3}}
5902 !! result
5903 <p>Foo
5904 </p>
5905 !! end
5906
5907 !! test
5908 <includeonly> and <noinclude> on a page
5909 !! input
5910 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
5911 !! result
5912 <p>Foozar
5913 </p>
5914 !! end
5915
5916 !! test
5917 Un-closed <noinclude>
5918 !! input
5919 <noinclude>
5920 !! result
5921 !! end
5922
5923 !! test
5924 <onlyinclude> on a page
5925 !! input
5926 <onlyinclude>Foo</onlyinclude>bar
5927 !! result
5928 <p>Foobar
5929 </p>
5930 !! end
5931
5932 !! test
5933 Un-closed <onlyinclude>
5934 !! input
5935 <onlyinclude>
5936 !! result
5937 !! end
5938
5939 !!test
5940 Self-closed noinclude, includeonly, onlyinclude tags
5941 !!input
5942 <noinclude />
5943 <includeonly />
5944 <onlyinclude />
5945 !!result
5946 <p><br />
5947 </p>
5948 !!end
5949
5950 !!test
5951 Unbalanced includeonly and noinclude tags
5952 !!input
5953 {|
5954 |a</noinclude>
5955 |b</noinclude></noinclude>
5956 |c</noinclude></includeonly>
5957 |d</includeonly></includeonly>
5958 |}
5959 !!result
5960 <table>
5961 <tr>
5962 <td>a
5963 </td>
5964 <td>b
5965 </td>
5966 <td>c&lt;/includeonly&gt;
5967 </td>
5968 <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
5969 </td></tr></table>
5970
5971 !!end
5972
5973 !! article
5974 Template:Includeonly section
5975 !! text
5976 <includeonly>
5977 ==Includeonly section==
5978 </includeonly>
5979 ==Section T-1==
5980 !!endarticle
5981
5982 !! test
5983 Bug 6563: Edit link generation for section shown by <includeonly>
5984 !! input
5985 {{includeonly section}}
5986 !! result
5987 <h2><span class="mw-headline" id="Includeonly_section">Includeonly section</span> <span class="mw-editsection">[<a href="/index.php?title=Template:Includeonly_section&amp;action=edit&amp;section=T-1" title="Template:Includeonly section">edit</a>]</span></h2>
5988 <h2><span class="mw-headline" id="Section_T-1">Section T-1</span> <span class="mw-editsection">[<a href="/index.php?title=Template:Includeonly_section&amp;action=edit&amp;section=T-2" title="Template:Includeonly section">edit</a>]</span></h2>
5989
5990 !! end
5991
5992 # Uses same input as the contents of [[Template:Includeonly section]]
5993 !! test
5994 Bug 6563: Section extraction for section shown by <includeonly>
5995 !! options
5996 section=T-2
5997 !! input
5998 <includeonly>
5999 ==Includeonly section==
6000 </includeonly>
6001 ==Section T-2==
6002 !! result
6003 ==Section T-2==
6004 !! end
6005
6006 !! test
6007 Bug 6563: Edit link generation for section suppressed by <includeonly>
6008 !! input
6009 <includeonly>
6010 ==Includeonly section==
6011 </includeonly>
6012 ==Section 1==
6013 !! result
6014 <h2><span class="mw-headline" id="Section_1">Section 1</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section 1">edit</a>]</span></h2>
6015
6016 !! end
6017
6018 !! test
6019 Bug 6563: Section extraction for section suppressed by <includeonly>
6020 !! options
6021 section=1
6022 !! input
6023 <includeonly>
6024 ==Includeonly section==
6025 </includeonly>
6026 ==Section 1==
6027 !! result
6028 ==Section 1==
6029 !! end
6030
6031 !! test
6032 Un-closed <includeonly>
6033 !! input
6034 <includeonly>
6035 !! result
6036 !! end
6037
6038 ###
6039 ### <includeonly> and <noinclude> in attributes
6040 ###
6041 !!test
6042 0. includeonly around the entire attribute
6043 !!input
6044 <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
6045 !!result
6046 <p><span id="v2">bar</span>
6047 </p>
6048 !!end
6049
6050 !!test
6051 1. includeonly in html attr key
6052 !!input
6053 <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
6054 !!result
6055 <p><span id="foo">bar</span>
6056 </p>
6057 !!end
6058
6059 !!test
6060 2. includeonly in html attr value
6061 !!input
6062 <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
6063 <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
6064 !!result
6065 <p><span id="v1">bar</span>
6066 <span id="v1">bar</span>
6067 </p>
6068 !!end
6069
6070 !!test
6071 3. includeonly in part of an attr value
6072 !!input
6073 <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
6074 !!result
6075 <p><span style="color:red;">bar</span>
6076 </p>
6077 !!end
6078
6079 ###
6080 ### Testing parsing of templates where a template arg
6081 ### has the same name as the template itself.
6082 ###
6083
6084 !! article
6085 Template:quote
6086 !! text
6087 {{{quote|{{{1}}}}}}
6088 !! endarticle
6089
6090 !!test
6091 Templates: Template Name/Arg clash: 1. Use of positional param
6092 !!input
6093 {{quote|foo}}
6094 !!result
6095 <p>foo
6096 </p>
6097 !!end
6098
6099 !!test
6100 Templates: Template Name/Arg clash: 2. Use of named param
6101 !!input
6102 {{quote|quote=foo}}
6103 !!result
6104 <p>foo
6105 </p>
6106 !!end
6107
6108 !!test
6109 Templates: Template Name/Arg clash: 3. Use of named param with empty input
6110 !!input
6111 {{quote|quote}}
6112 !!result
6113 <p>quote
6114 </p>
6115 !!end
6116
6117 ###
6118 ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
6119 ###
6120
6121 !!test
6122 Templates: 1. Simple use
6123 !!input
6124 {{echo|Foo}}
6125 !!result
6126 <p>Foo
6127 </p>
6128 !!end
6129
6130 !!test
6131 Templates: 2. Inside a block tag
6132 !!input
6133 <div>{{echo|Foo}}</div>
6134 !!result
6135 <div>Foo</div>
6136
6137 !!end
6138
6139 !!test
6140 Templates: P-wrapping: 1a. Templates on consecutive lines
6141 !!input
6142 {{echo|Foo}}
6143 {{echo|bar}}
6144 !!result
6145 <p>Foo
6146 bar
6147 </p>
6148 !!end
6149
6150 !!test
6151 Templates: P-wrapping: 1b. Templates on consecutive lines
6152 !!input
6153 Foo
6154
6155 {{echo|bar}}
6156 {{echo|baz}}
6157 !!result
6158 <p>Foo
6159 </p><p>bar
6160 baz
6161 </p>
6162 !!end
6163
6164 !!test
6165 Templates: P-wrapping: 1c. Templates on consecutive lines
6166 !!input
6167 {{echo|Foo}}
6168 {{echo|bar}} <div>baz</div>
6169 !!result
6170 <p>Foo
6171 </p>
6172 bar <div>baz</div>
6173
6174 !!end
6175
6176 !!test
6177 Templates: P-wrapping: 1d. Template preceded by comment-only line
6178 !!options
6179 parsoid
6180 !!input
6181 <!-- foo -->
6182 {{echo|Bar}}
6183 !!result
6184 <!-- foo -->
6185 <p>Bar
6186 </p>
6187 !!end
6188
6189 !!test
6190 Templates: Inline Text: 1. Multiple tmeplate uses
6191 !!input
6192 {{echo|Foo}}bar{{echo|baz}}
6193 !!result
6194 <p>Foobarbaz
6195 </p>
6196 !!end
6197
6198 !!test
6199 Templates: Inline Text: 2. Back-to-back template uses
6200 !!input
6201 {{echo|Foo}}{{echo|bar}}
6202 !!result
6203 <p>Foobar
6204 </p>
6205 !!end
6206
6207 !!test
6208 Templates: Block Tags: 1. Multiple template uses
6209 !!input
6210 {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
6211 !!result
6212 <div>Foo</div><div>bar</div><div>baz</div>
6213
6214 !!end
6215
6216 !!test
6217 Templates: Block Tags: 2. Back-to-back template uses
6218 !!input
6219 {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
6220 !!result
6221 <div>Foo</div><div>bar</div>
6222
6223 !!end
6224
6225 !!test
6226 Templates: Links: 1. Simple example
6227 !!input
6228 {{echo|[[Foo|bar]]}}
6229 !!result
6230 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6231 </p>
6232 !!end
6233
6234 !!test
6235 Templates: Links: 2. Generation of link href
6236 !!input
6237 [[{{echo|Foo}}|bar]]
6238 !!result
6239 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6240 </p>
6241 !!end
6242
6243 !!test
6244 Templates: Links: 3. Generation of part of a link href
6245 !!input
6246 [[Fo{{echo|o}}|bar]]
6247
6248 [[Foo{{echo|bar}}]]
6249
6250 [[Foo{{echo|bar}}baz]]
6251
6252 [[Foo{{echo|bar}}|bar]]
6253
6254 [[:Foo{{echo|bar}}]]
6255
6256 [[:Foo{{echo|bar}}|bar]]
6257 !!result
6258 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6259 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
6260 </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
6261 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
6262 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
6263 </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
6264 </p>
6265 !!end
6266
6267 !!test
6268 Templates: Links: 4. Multiple templates generating link href
6269 !!input
6270 [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
6271 !!result
6272 <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
6273 </p>
6274 !!end
6275
6276 !!test
6277 Templates: Links: 5. Generation of link text
6278 !!input
6279 [[Foo|{{echo|bar}}]]
6280 !!result
6281 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6282 </p>
6283 !!end
6284
6285 !!test
6286 Templates: Links: 5. Nested templates (only outermost template should be marked)
6287 !!input
6288 {{echo|[[{{echo|Foo}}|bar]]}}
6289 !!result
6290 <p><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">bar</a>
6291 </p>
6292 !!end
6293
6294 !!test
6295 Templates: HTML Tag: 1. Generation of HTML attr. key
6296 !!input
6297 <div {{echo|style}}="color:red;">foo</div>
6298 !!result
6299 <div style="color:red;">foo</div>
6300
6301 !!end
6302
6303 !!test
6304 Templates: HTML Tag: 2. Generation of HTML attr. value
6305 !!input
6306 <div style={{echo|'color:red;'}}>foo</div>
6307 !!result
6308 <div style="color:red;">foo</div>
6309
6310 !!end
6311
6312 !!test
6313 Templates: HTML Tag: 3. Generation of HTML attr key and value
6314 !!input
6315 <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
6316 !!result
6317 <div style="color:red;">foo</div>
6318
6319 !!end
6320
6321 !!test
6322 Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
6323 !!input
6324 <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
6325 !!result
6326 <div title="This is a long title with just one piece templated">foo</div>
6327
6328 !!end
6329
6330 !!test
6331 Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
6332 !!input
6333 <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
6334 !!result
6335 <div title="This is a long title with just one piece templated">foo</div>
6336
6337 !!end
6338
6339 !!test
6340 Templates: HTML Tag: 6. Generation of end piece of HTML attr value
6341 !!input
6342 <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
6343 !!result
6344 <div title="This is a long title with just one piece templated">foo</div>
6345
6346 !!end
6347
6348 !!test
6349 Templates: HTML Tag: 7. Generation of partial attribute key string
6350 !!input
6351 <div st{{echo|yle}}="color:red;">foo</div>
6352 !!result
6353 <div style="color:red;">foo</div>
6354
6355 !!end
6356
6357 !!test
6358 Templates: HTML Tables: 1. Generating start of a HTML table
6359 !!input
6360 {{echo|<table><tr><td>foo</td>}}</tr></table>
6361 !!result
6362 <table><tr><td>foo</td></tr></table>
6363
6364 !!end
6365
6366 !!test
6367 Templates: HTML Tables: 2a. Generating middle of a HTML table
6368 !!input
6369 <table><tr>{{echo|<td>foo</td>}}</tr></table>
6370 !!result
6371 <table><tr><td>foo</td></tr></table>
6372
6373 !!end
6374
6375 !!test
6376 Templates: HTML Tables: 2b. Generating middle of a HTML table
6377 !!input
6378 <table>{{echo|<tr><td>foo</td></tr>}}</table>
6379 !!result
6380 <table><tr><td>foo</td></tr></table>
6381
6382 !!end
6383
6384 !!test
6385 Templates: HTML Tables: 3. Generating end of a HTML table
6386 !!input
6387 <table><tr>{{echo|<td>foo</td></tr></table>}}
6388 !!result
6389 <table><tr><td>foo</td></tr></table>
6390
6391 !!end
6392
6393 !!test
6394 Templates: HTML Tables: 4a. Generating a single tag of a HTML table
6395 !!input
6396 {{echo|<table>}}<tr><td>foo</td></tr></table>
6397 !!result
6398 <table><tr><td>foo</td></tr></table>
6399
6400 !!end
6401
6402 !!test
6403 Templates: HTML Tables: 4b. Generating a single tag of a HTML table
6404 !!input
6405 <table>{{echo|<tr>}}<td>foo</td></tr></table>
6406 !!result
6407 <table><tr><td>foo</td></tr></table>
6408
6409 !!end
6410
6411 !!test
6412 Templates: HTML Tables: 4c. Generating a single tag of a HTML table
6413 !!input
6414 <table><tr>{{echo|<td>}}foo</td></tr></table>
6415 !!result
6416 <table><tr><td>foo</td></tr></table>
6417
6418 !!end
6419
6420 !!test
6421 Templates: HTML Tables: 4d. Generating a single tag of a HTML table
6422 !!input
6423 <table><tr><td>foo{{echo|</td>}}</tr></table>
6424 !!result
6425 <table><tr><td>foo</td></tr></table>
6426
6427 !!end
6428
6429 !!test
6430 Templates: HTML Tables: 4e. Generating a single tag of a HTML table
6431 !!input
6432 <table><tr><td>foo</td>{{echo|</tr>}}</table>
6433 !!result
6434 <table><tr><td>foo</td></tr></table>
6435
6436 !!end
6437
6438 !!test
6439 Templates: HTML Tables: 4f. Generating a single tag of a HTML table
6440 !!input
6441 <table><tr><td>foo</td></tr>{{echo|</table>}}
6442 !!result
6443 <table><tr><td>foo</td></tr></table>
6444
6445 !!end
6446
6447 !!test
6448 Templates: Wiki Tables: 1a. Fostering of entire template content
6449 !!input
6450 {|
6451 {{echo|a}}
6452 |}
6453 !!result
6454 <table>
6455 a
6456 <tr><td></td></tr></table>
6457
6458 !!end
6459
6460 !!test
6461 Templates: Wiki Tables: 1b. Fostering of entire template content
6462 !!input
6463 {|
6464 {{echo|<div>}}
6465 foo
6466 {{echo|</div>}}
6467 |}
6468 !!result
6469 <table>
6470 <div>
6471 <p>foo
6472 </p>
6473 </div>
6474 <tr><td></td></tr></table>
6475
6476 !!end
6477
6478 !!test
6479 Templates: Wiki Tables: 2. Fostering of partial template content
6480 !!input
6481 {|
6482 {{echo|a
6483 <div>b</div>}}
6484 |}
6485 !!result
6486 <table>
6487 a
6488 <div>b</div>
6489 <tr><td></td></tr></table>
6490
6491 !!end
6492
6493 !!test
6494 Templates: Wiki Tables: 3. td-content via multiple templates
6495 !!input
6496 {|
6497 {{echo|{{pipe}}a}}{{echo|b}}
6498 |}
6499 !!result
6500 <table>
6501 <tr>
6502 <td>ab
6503 </td></tr></table>
6504
6505 !!end
6506
6507 !!test
6508 Templates: Wiki Tables: 4. Templated tags, no content
6509 !!input
6510 {{tbl-start}}
6511 {{tbl-end}}
6512 !!result
6513 <table>
6514 <tr><td></td></tr></table>
6515
6516 !!end
6517
6518 !!test
6519 Templates: Wiki Tables: 5. Templated tags, regular td-tags
6520 !!input
6521 {{tbl-start}}
6522 |foo
6523 {{tbl-end}}
6524 !!result
6525 <table>
6526 <tr>
6527 <td>foo
6528 </td></tr></table>
6529
6530 !!end
6531
6532 !!test
6533 Templates: Wiki Tables: 6. Templated tags, templated td-tags
6534 !!input
6535 {{tbl-start}}
6536 {{!}}foo
6537 {{tbl-end}}
6538 !!result
6539 <table>
6540 <tr>
6541 <td>foo
6542 </td></tr></table>
6543
6544 !!end
6545
6546 !!test
6547 Templates: Lists: Multi-line list-items via templates
6548 !!input
6549 *{{echo|a {{nonexistent|
6550 unused}}}}
6551 *{{echo|b {{nonexistent|
6552 unused}}}}
6553 !!result
6554 <ul><li>a <a href="/index.php?title=Template:Nonexistent&amp;action=edit&amp;redlink=1" class="new" title="Template:Nonexistent (page does not exist)">Template:Nonexistent</a>
6555 </li><li>b <a href="/index.php?title=Template:Nonexistent&amp;action=edit&amp;redlink=1" class="new" title="Template:Nonexistent (page does not exist)">Template:Nonexistent</a>
6556 </li></ul>
6557
6558 !!end
6559
6560 !!test
6561 Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
6562 !!input
6563 {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
6564 !!result
6565 <p><i>ab</i>c<i>d</i>e
6566 </p>
6567 !!end
6568
6569 !!test
6570 Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
6571 (PHP parser generates misnested html)
6572 !! options
6573 parsoid
6574 !!input
6575 {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
6576 !!result
6577 <p><span><i>a</i></span><i><span>b</span></i><span>c</span><i>d</i><span>e</span></p>
6578 !!end
6579
6580 !!test
6581 Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
6582 (PHP parser generates misnested html)
6583 !! options
6584 parsoid
6585 !!input
6586 {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
6587 !!result
6588 <div><i>a</i></div>
6589 <div><i>b</i>c<i>d</i></div>
6590 <div>e</div>
6591 !!end
6592
6593 !!test
6594 Templates: Ugly nesting: 4. Divs opened/closed across templates
6595 !!input
6596 a<div>b{{echo|c</div>d}}e
6597 !!result
6598 a<div>bc</div>de
6599
6600 !!end
6601
6602 !!test
6603 Templates: Ugly templates: 1. Navbox template parses badly leading to table misnesting
6604 (Parsoid-centric)
6605 !! options
6606 parsoid
6607 !!input
6608 {|
6609 |{{echo|foo</table>}}
6610 |bar
6611 |}
6612 !!result
6613 <table about="#mwt1" typeof="mw:Object/Template ">
6614 <tbody><tr><td>foo</td></tr></tbody></table><span about="#mwt1">
6615 bar</span><span about="#mwt1">
6616 </span>
6617 !!end
6618
6619 !!test
6620 Templates: Ugly templates: 2. Navbox template parses badly leading to table misnesting
6621 (Parsoid-centric)
6622 !! options
6623 parsoid
6624 !!input
6625 <table>
6626 <tr>
6627 <td>
6628 <table>
6629 <tr>
6630 <td>1. {{echo|foo </table>}}</td>
6631 <td> bar </td>
6632 <td>2. {{echo|baz </table>}}</td>
6633 </tr>
6634 <tr>
6635 <td>abc</td>
6636 </tr>
6637 </table>
6638 </td>
6639 </tr>
6640 <tr>
6641 <td>xyz</td>
6642 </tr>
6643 </table>
6644 !!result
6645 <table about="#mwt1" typeof="mw:Object/Template">
6646 <tbody><tr >
6647 <td >
6648 <table >
6649 <tbody><tr >
6650 <td >1. foo </td></tr></tbody></table></td>
6651 <td > bar </td>
6652 <td >2. baz </td></tr></tbody></table><span about="#mwt1">
6653 </span><span about="#mwt1">
6654
6655 abc</span><span about="#mwt1">
6656 </span><span about="#mwt1">
6657 </span><span about="#mwt1">
6658 </span><span about="#mwt1">
6659 </span><span about="#mwt1">
6660
6661 xyz</span><span about="#mwt1">
6662 </span><span about="#mwt1">
6663 </span>
6664 !!end
6665
6666 !! test
6667 Templates: Ugly templates: 3. newline-only template parameter
6668 !! input
6669 foo {{echo|
6670 }}
6671 !! result
6672 <p>foo
6673 </p>
6674 !! end
6675
6676 # This looks like a bug: a single newline triggers p/br for some reason.
6677 !! test
6678 Templates: Ugly templates: 4. newline-only template parameter inconsistency
6679 !! input
6680 {{echo|
6681 }}
6682 !! result
6683 <p><br />
6684 </p>
6685 !! end
6686
6687
6688 !!test
6689 Parser Functions: 1. Simple example
6690 !!input
6691 {{uc:foo}}
6692 !!result
6693 <p>FOO
6694 </p>
6695 !!end
6696
6697 !!test
6698 Parser Functions: 2. Nested use (only outermost should be marked up)
6699 !!input
6700 {{uc:{{lc:FOO}}}}
6701 !!result
6702 <p>FOO
6703 </p>
6704 !!end
6705
6706 ###
6707 ### Pre-save transform tests
6708 ###
6709 !! test
6710 pre-save transform: subst:
6711 !! options
6712 PST
6713 !! input
6714 {{subst:test}}
6715 !! result
6716 This is a test template
6717 !! end
6718
6719 !! test
6720 pre-save transform: normal template
6721 !! options
6722 PST
6723 !! input
6724 {{test}}
6725 !! result
6726 {{test}}
6727 !! end
6728
6729 !! test
6730 pre-save transform: nonexistent template
6731 !! options
6732 PST
6733 !! input
6734 {{thistemplatedoesnotexist}}
6735 !! result
6736 {{thistemplatedoesnotexist}}
6737 !! end
6738
6739
6740 !! test
6741 pre-save transform: subst magic variables
6742 !! options
6743 PST
6744 !! input
6745 {{subst:SITENAME}}
6746 !! result
6747 MediaWiki
6748 !! end
6749
6750 # This is bug 89, which I fixed. -- wtm
6751 !! test
6752 pre-save transform: subst: templates with parameters
6753 !! options
6754 pst
6755 !! input
6756 {{subst:paramtest|param="something else"}}
6757 !! result
6758 This is a test template with parameter "something else"
6759 !! end
6760
6761 !! article
6762 Template:nowikitest
6763 !! text
6764 <nowiki>'''not wiki'''</nowiki>
6765 !! endarticle
6766
6767 !! test
6768 pre-save transform: nowiki in subst (bug 1188)
6769 !! options
6770 pst
6771 !! input
6772 {{subst:nowikitest}}
6773 !! result
6774 <nowiki>'''not wiki'''</nowiki>
6775 !! end
6776
6777
6778 !! article
6779 Template:commenttest
6780 !! text
6781 This template has <!-- a comment --> in it.
6782 !! endarticle
6783
6784 !! test
6785 pre-save transform: comment in subst (bug 1936)
6786 !! options
6787 pst
6788 !! input
6789 {{subst:commenttest}}
6790 !! result
6791 This template has <!-- a comment --> in it.
6792 !! end
6793
6794 !! test
6795 pre-save transform: unclosed tag
6796 !! options
6797 pst noxml
6798 !! input
6799 <nowiki>'''not wiki'''
6800 !! result
6801 <nowiki>'''not wiki'''
6802 !! end
6803
6804 !! test
6805 pre-save transform: mixed tag case
6806 !! options
6807 pst noxml
6808 !! input
6809 <NOwiki>'''not wiki'''</noWIKI>
6810 !! result
6811 <NOwiki>'''not wiki'''</noWIKI>
6812 !! end
6813
6814 !! test
6815 pre-save transform: unclosed comment in <nowiki>
6816 !! options
6817 pst noxml
6818 !! input
6819 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
6820 !! result
6821 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
6822 !!end
6823
6824 !! article
6825 Template:dangerous
6826 !!text
6827 <span onmouseover="alert('crap')">Oh no</span>
6828 !!endarticle
6829
6830 !!test
6831 (confirming safety of fix for subst bug 1936)
6832 !! input
6833 {{Template:dangerous}}
6834 !! result
6835 <p><span>Oh no</span>
6836 </p>
6837 !! end
6838
6839 !! test
6840 pre-save transform: comment containing gallery (bug 5024)
6841 !! options
6842 pst
6843 !! input
6844 <!-- <gallery>data</gallery> -->
6845 !!result
6846 <!-- <gallery>data</gallery> -->
6847 !!end
6848
6849 !! test
6850 pre-save transform: comment containing extension
6851 !! options
6852 pst
6853 !! input
6854 <!-- <tag>data</tag> -->
6855 !!result
6856 <!-- <tag>data</tag> -->
6857 !!end
6858
6859 !! test
6860 pre-save transform: comment containing nowiki
6861 !! options
6862 pst
6863 !! input
6864 <!-- <nowiki>data</nowiki> -->
6865 !!result
6866 <!-- <nowiki>data</nowiki> -->
6867 !!end
6868
6869 !! test
6870 pre-save transform: <noinclude> in subst (bug 3298)
6871 !! options
6872 pst
6873 !! input
6874 {{subst:Includes}}
6875 !! result
6876 Foobar
6877 !! end
6878
6879 !! test
6880 pre-save transform: <onlyinclude> in subst (bug 3298)
6881 !! options
6882 pst
6883 !! input
6884 {{subst:Includes2}}
6885 !! result
6886 Foo
6887 !! end
6888
6889 !! article
6890 Template:SubstTest
6891 !!text
6892 {{<includeonly>subst:</includeonly>Includes}}
6893 !! endarticle
6894
6895 !! article
6896 Template:SafeSubstTest
6897 !! text
6898 {{<includeonly>safesubst:</includeonly>Includes}}
6899 !! endarticle
6900
6901 !! test
6902 bug 22297: safesubst: works during PST
6903 !! options
6904 pst
6905 !! input
6906 {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
6907 !! result
6908 FoobarFoobar
6909 !! end
6910
6911 !! test
6912 bug 22297: safesubst: works during normal parse
6913 !! input
6914 {{SafeSubstTest}}
6915 !! result
6916 <p>Foobar
6917 </p>
6918 !! end
6919
6920 !! test:
6921 subst: does not work during normal parse
6922 !! input
6923 {{SubstTest}}
6924 !! result
6925 <p>{{subst:Includes}}
6926 </p>
6927 !! end
6928
6929 !! test
6930 pre-save transform: context links ("pipe trick")
6931 !! options
6932 pst
6933 !! input
6934 [[Article (context)|]]
6935 [[Bar:Article|]]
6936 [[:Bar:Article|]]
6937 [[Bar:Article (context)|]]
6938 [[:Bar:Article (context)|]]
6939 [[|Article]]
6940 [[|Article (context)]]
6941 [[Bar:X (Y) Z|]]
6942 [[:Bar:X (Y) Z|]]
6943 !! result
6944 [[Article (context)|Article]]
6945 [[Bar:Article|Article]]
6946 [[:Bar:Article|Article]]
6947 [[Bar:Article (context)|Article]]
6948 [[:Bar:Article (context)|Article]]
6949 [[Article]]
6950 [[Article (context)]]
6951 [[Bar:X (Y) Z|X (Y) Z]]
6952 [[:Bar:X (Y) Z|X (Y) Z]]
6953 !! end
6954
6955 !! test
6956 pre-save transform: context links ("pipe trick") with interwiki prefix
6957 !! options
6958 pst
6959 !! input
6960 [[interwiki:Article|]]
6961 [[:interwiki:Article|]]
6962 [[interwiki:Bar:Article|]]
6963 [[:interwiki:Bar:Article|]]
6964 !! result
6965 [[interwiki:Article|Article]]
6966 [[:interwiki:Article|Article]]
6967 [[interwiki:Bar:Article|Bar:Article]]
6968 [[:interwiki:Bar:Article|Bar:Article]]
6969 !! end
6970
6971 !! test
6972 pre-save transform: context links ("pipe trick") with parens in title
6973 !! options
6974 pst title=[[Somearticle (context)]]
6975 !! input
6976 [[|Article]]
6977 !! result
6978 [[Article (context)|Article]]
6979 !! end
6980
6981 !! test
6982 pre-save transform: context links ("pipe trick") with comma in title
6983 !! options
6984 pst title=[[Someplace, Somewhere]]
6985 !! input
6986 [[|Otherplace]]
6987 [[Otherplace, Elsewhere|]]
6988 [[Otherplace, Elsewhere, Anywhere|]]
6989 !! result
6990 [[Otherplace, Somewhere|Otherplace]]
6991 [[Otherplace, Elsewhere|Otherplace]]
6992 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
6993 !! end
6994
6995 !! test
6996 pre-save transform: context links ("pipe trick") with parens and comma
6997 !! options
6998 pst title=[[Someplace (IGNORED), Somewhere]]
6999 !! input
7000 [[|Otherplace]]
7001 [[Otherplace (place), Elsewhere|]]
7002 !! result
7003 [[Otherplace, Somewhere|Otherplace]]
7004 [[Otherplace (place), Elsewhere|Otherplace]]
7005 !! end
7006
7007 !! test
7008 pre-save transform: context links ("pipe trick") with comma and parens
7009 !! options
7010 pst title=[[Who, me? (context)]]
7011 !! input
7012 [[|Yes, you.]]
7013 [[Me, Myself, and I (1937 song)|]]
7014 !! result
7015 [[Yes, you. (context)|Yes, you.]]
7016 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
7017 !! end
7018
7019 !! test
7020 pre-save transform: context links ("pipe trick") with namespace
7021 !! options
7022 pst title=[[Ns:Somearticle]]
7023 !! input
7024 [[|Article]]
7025 !! result
7026 [[Ns:Article|Article]]
7027 !! end
7028
7029 !! test
7030 pre-save transform: context links ("pipe trick") with namespace and parens
7031 !! options
7032 pst title=[[Ns:Somearticle (context)]]
7033 !! input
7034 [[|Article]]
7035 !! result
7036 [[Ns:Article (context)|Article]]
7037 !! end
7038
7039 !! test
7040 pre-save transform: context links ("pipe trick") with namespace and comma
7041 !! options
7042 pst title=[[Ns:Somearticle, Context, Whatever]]
7043 !! input
7044 [[|Article]]
7045 !! result
7046 [[Ns:Article, Context, Whatever|Article]]
7047 !! end
7048
7049 !! test
7050 pre-save transform: context links ("pipe trick") with namespace, comma and parens
7051 !! options
7052 pst title=[[Ns:Somearticle, Context (context)]]
7053 !! input
7054 [[|Article]]
7055 !! result
7056 [[Ns:Article (context)|Article]]
7057 !! end
7058
7059 !! test
7060 pre-save transform: context links ("pipe trick") with namespace, parens and comma
7061 !! options
7062 pst title=[[Ns:Somearticle (IGNORED), Context]]
7063 !! input
7064 [[|Article]]
7065 !! result
7066 [[Ns:Article, Context|Article]]
7067 !! end
7068
7069 !! test
7070 pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, bug 30149)
7071 !! options
7072 pst
7073 !! input
7074 [[Article(context)|]]
7075 [[Bar:Article(context)|]]
7076 [[:Bar:Article(context)|]]
7077 [[|Article(context)]]
7078 [[Bar:X(Y)Z|]]
7079 [[:Bar:X(Y)Z|]]
7080 !! result
7081 [[Article(context)|Article]]
7082 [[Bar:Article(context)|Article]]
7083 [[:Bar:Article(context)|Article]]
7084 [[Article(context)]]
7085 [[Bar:X(Y)Z|X(Y)Z]]
7086 [[:Bar:X(Y)Z|X(Y)Z]]
7087 !! end
7088
7089 !! test
7090 pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, bug 30149)
7091 !! options
7092 pst
7093 !! input
7094 [[Article (context)|]]
7095 [[Bar:Article (context)|]]
7096 [[:Bar:Article (context)|]]
7097 [[|Article (context)]]
7098 [[Bar:X (Y) Z|]]
7099 [[:Bar:X (Y) Z|]]
7100 !! result
7101 [[Article (context)|Article]]
7102 [[Bar:Article (context)|Article]]
7103 [[:Bar:Article (context)|Article]]
7104 [[Article (context)]]
7105 [[Bar:X (Y) Z|X (Y) Z]]
7106 [[:Bar:X (Y) Z|X (Y) Z]]
7107 !! end
7108
7109 !! test
7110 pre-save transform: context links ("pipe trick") with parens and no space (Korean style, bug 30149)
7111 !! options
7112 pst
7113 !! input
7114 [[Article(context)|]]
7115 [[Bar:Article(context)|]]
7116 [[:Bar:Article(context)|]]
7117 [[|Article(context)]]
7118 [[Bar:X(Y)Z|]]
7119 [[:Bar:X(Y)Z|]]
7120 !! result
7121 [[Article(context)|Article]]
7122 [[Bar:Article(context)|Article]]
7123 [[:Bar:Article(context)|Article]]
7124 [[Article(context)]]
7125 [[Bar:X(Y)Z|X(Y)Z]]
7126 [[:Bar:X(Y)Z|X(Y)Z]]
7127 !! end
7128
7129 !! test
7130 pre-save transform: context links ("pipe trick") with commas (bug 21660)
7131 !! options
7132 pst
7133 !! input
7134 [[Article (context), context|]]
7135 [[Article (context),context|]]
7136 [[Bar:Article (context), context|]]
7137 [[Bar:Article (context),context|]]
7138 [[:Bar:Article (context), context|]]
7139 [[:Bar:Article (context),context|]]
7140 !! result
7141 [[Article (context), context|Article]]
7142 [[Article (context),context|Article]]
7143 [[Bar:Article (context), context|Article]]
7144 [[Bar:Article (context),context|Article]]
7145 [[:Bar:Article (context), context|Article]]
7146 [[:Bar:Article (context),context|Article]]
7147 !! end
7148
7149 !! test
7150 pre-save transform: trim trailing empty lines
7151 !! options
7152 pst
7153 !! input
7154 Empty lines are trimmed
7155
7156
7157
7158
7159 !! result
7160 Empty lines are trimmed
7161 !! end
7162
7163 !! test
7164 pre-save transform: Signature expansion
7165 !! options
7166 pst
7167 !! input
7168 * ~~~
7169 * <noinclude>~~~</noinclude>
7170 * <includeonly>~~~</includeonly>
7171 * <onlyinclude>~~~</onlyinclude>
7172 !! result
7173 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
7174 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
7175 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
7176 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
7177 !! end
7178
7179
7180 !! test
7181 pre-save transform: Signature expansion in nowiki tags (bug 93)
7182 !! options
7183 pst disabled
7184 !! input
7185 Shall not expand:
7186
7187 <nowiki>~~~~</nowiki>
7188
7189 <includeonly><nowiki>~~~~</nowiki></includeonly>
7190
7191 <noinclude><nowiki>~~~~</nowiki></noinclude>
7192
7193 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
7194
7195 {{subst:Foo}} shall be converted to FOO
7196
7197 As well as inside noinclude/onlyinclude
7198 <noinclude>{{subst:Foo}}</noinclude>
7199 <onlyinclude>{{subst:Foo}}</onlyinclude>
7200
7201 But not inside includeonly
7202 <includeonly>{{subst:Foo}}</includeonly>
7203 !! result
7204 Shall not expand:
7205
7206 <nowiki>~~~~</nowiki>
7207
7208 <includeonly><nowiki>~~~~</nowiki></includeonly>
7209
7210 <noinclude><nowiki>~~~~</nowiki></noinclude>
7211
7212 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
7213
7214 FOO shall be converted to FOO
7215
7216 As well as inside noinclude/onlyinclude
7217 <noinclude>FOO</noinclude>
7218 <onlyinclude>FOO</onlyinclude>
7219
7220 But not inside includeonly
7221 <includeonly>{{subst:Foo}}</includeonly>
7222 !! end
7223
7224 ###
7225 ### Message transform tests
7226 ###
7227 !! test
7228 message transform: magic variables
7229 !! options
7230 msg
7231 !! input
7232 {{SITENAME}}
7233 !! result
7234 MediaWiki
7235 !! end
7236
7237 !! test
7238 message transform: should not transform wiki markup
7239 !! options
7240 msg
7241 !! input
7242 ''test''
7243 !! result
7244 ''test''
7245 !! end
7246
7247 !! test
7248 message transform: <noinclude> in transcluded template (bug 4926)
7249 !! options
7250 msg
7251 !! input
7252 {{Includes}}
7253 !! result
7254 Foobar
7255 !! end
7256
7257 !! test
7258 message transform: <onlyinclude> in transcluded template (bug 4926)
7259 !! options
7260 msg
7261 !! input
7262 {{Includes2}}
7263 !! result
7264 Foo
7265 !! end
7266
7267 !! test
7268 {{#special:}} page name, known
7269 !! options
7270 msg
7271 !! input
7272 {{#special:Recentchanges}}
7273 !! result
7274 Special:RecentChanges
7275 !! end
7276
7277 !! test
7278 {{#special:}} page name with subpage, known
7279 !! options
7280 msg
7281 !! input
7282 {{#special:Recentchanges/param}}
7283 !! result
7284 Special:RecentChanges/param
7285 !! end
7286
7287 !! test
7288 {{#special:}} page name, unknown
7289 !! options
7290 msg
7291 !! input
7292 {{#special:foobarnonexistent}}
7293 !! result
7294 No such special page
7295 !! end
7296
7297 !! test
7298 {{#speciale:}} page name, known
7299 !! options
7300 msg
7301 !! input
7302 {{#speciale:Recentchanges}}
7303 !! result
7304 Special:RecentChanges
7305 !! end
7306
7307 !! test
7308 {{#speciale:}} page name with subpage, known
7309 !! options
7310 msg
7311 !! input
7312 {{#speciale:Recentchanges/param}}
7313 !! result
7314 Special:RecentChanges/param
7315 !! end
7316
7317 !! test
7318 {{#speciale:}} page name, unknown
7319 !! options
7320 msg
7321 !! input
7322 {{#speciale:foobarnonexistent}}
7323 !! result
7324 No_such_special_page
7325 !! end
7326
7327 ###
7328 ### Images
7329 ###
7330 !! test
7331 Simple image
7332 !! input
7333 [[Image:foobar.jpg]]
7334 !! result
7335 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7336 </p>
7337 !! end
7338
7339 !! test
7340 Right-aligned image
7341 !! input
7342 [[Image:foobar.jpg|right]]
7343 !! result
7344 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
7345
7346 !! end
7347
7348 !! test
7349 Simple image (using File: namespace, now canonical)
7350 !! input
7351 [[File:foobar.jpg]]
7352 !! result
7353 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7354 </p>
7355 !! end
7356
7357 !! test
7358 Image with caption
7359 !! input
7360 [[Image:foobar.jpg|right|Caption text]]
7361 !! result
7362 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption text"><img alt="Caption text" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
7363
7364 !! end
7365
7366 !! test
7367 Image with empty attribute
7368 !! input
7369 [[Image:foobar.jpg|right||Caption text]]
7370 !! result
7371 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption text"><img alt="Caption text" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
7372
7373 !! end
7374
7375 !! test
7376 Image with link tails
7377 !! input
7378 123[[Image:foobar.jpg]]456
7379 123[[Image:foobar.jpg|right]]456
7380 123[[Image:foobar.jpg|thumb]]456
7381 !! result
7382 <p>123<a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>456
7383 </p>
7384 123<div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>456
7385 123<div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div></div></div></div>456
7386
7387 !! end
7388
7389 !! test
7390 Image with multiple captions -- only last one is accepted
7391 !! input
7392 [[Image:foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
7393 !! result
7394 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption3 - accepted"><img alt="Caption3 - accepted" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
7395
7396 !! end
7397
7398 !! test
7399 Image with width attribute at different positions
7400 !! input
7401 [[Image:foobar.jpg|200px|right|Caption]]
7402 [[Image:foobar.jpg|right|200px|Caption]]
7403 [[Image:foobar.jpg|right|Caption|200px]]
7404 !! result
7405 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption"><img alt="Caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" /></a></div>
7406 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption"><img alt="Caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" /></a></div>
7407 <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption"><img alt="Caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" /></a></div>
7408
7409 !! end
7410
7411 !! test
7412 Image with link parameter, wiki target
7413 !! input
7414 [[Image:foobar.jpg|link=Target page]]
7415 !! result
7416 <p><a href="/wiki/Target_page" title="Target page"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7417 </p>
7418 !! end
7419
7420 !! test
7421 Image with link parameter, URL target
7422 !! input
7423 [[Image:foobar.jpg|link=http://example.com/]]
7424 !! result
7425 <p><a href="http://example.com/" rel="nofollow"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7426 </p>
7427 !! end
7428
7429 !! test
7430 Image with link parameter, wgExternalLinkTarget
7431 !! input
7432 [[Image:foobar.jpg|link=http://example.com/]]
7433 !! config
7434 wgExternalLinkTarget='foobar'
7435 !! result
7436 <p><a href="http://example.com/" target="foobar" rel="nofollow"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7437 </p>
7438 !! end
7439
7440 !! test
7441 Image with link parameter, wgNoFollowLinks set to false
7442 !! input
7443 [[Image:foobar.jpg|link=http://example.com/]]
7444 !! config
7445 wgNoFollowLinks=false
7446 !! result
7447 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7448 </p>
7449 !! end
7450
7451 !! test
7452 Image with link parameter, wgNoFollowDomainExceptions
7453 !! input
7454 [[Image:foobar.jpg|link=http://example.com/]]
7455 !! config
7456 wgNoFollowDomainExceptions='example.com'
7457 !! result
7458 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7459 </p>
7460 !! end
7461
7462 !! test
7463 Image with link parameter, wgExternalLinkTarget, unnamed parameter
7464 !! input
7465 [[Image:foobar.jpg|link=http://example.com/|Title]]
7466 !! config
7467 wgExternalLinkTarget='foobar'
7468 !! result
7469 <p><a href="http://example.com/" title="Title" target="foobar" rel="nofollow"><img alt="Title" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7470 </p>
7471 !! end
7472
7473 !! test
7474 Image with empty link parameter
7475 !! input
7476 [[Image:foobar.jpg|link=]]
7477 !! result
7478 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
7479 </p>
7480 !! end
7481
7482 !! test
7483 Image with link parameter (wiki target) and unnamed parameter
7484 !! input
7485 [[Image:foobar.jpg|link=Target page|Title]]
7486 !! result
7487 <p><a href="/wiki/Target_page" title="Title"><img alt="Title" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7488 </p>
7489 !! end
7490
7491 !! test
7492 Image with link parameter (URL target) and unnamed parameter
7493 !! input
7494 [[Image:foobar.jpg|link=http://example.com/|Title]]
7495 !! result
7496 <p><a href="http://example.com/" title="Title" rel="nofollow"><img alt="Title" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7497 </p>
7498 !! end
7499
7500 !! test
7501 Thumbnail image with link parameter
7502 !! options
7503 php
7504 !! input
7505 [[Image:foobar.jpg|thumb|link=http://example.com/|Title]]
7506 !! result
7507 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="http://example.com/"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Title</div></div></div>
7508
7509 !! end
7510
7511 !! test
7512 Manually-specified thumbnail image
7513 !! options
7514 php
7515 !! input
7516 [[Image:Foobar.jpg|thumb=Thumb.png|Title]]
7517 !! result
7518 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><a href="/wiki/File:Foobar.jpg"><img alt="" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Title</div></div></div>
7519
7520 !! end
7521
7522 !! test
7523 Manually-specified thumbnail image with explicit link to wiki page
7524 !! options
7525 php
7526 !! input
7527 [[Image:Foobar.jpg|thumb=Thumb.png|link=Main Page|Title]]
7528 !! result
7529 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><a href="/wiki/Main_Page" title="Main Page"><img alt="" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Title</div></div></div>
7530
7531 !! end
7532
7533 !! test
7534 Manually-specified thumbnail image with explicit link to url
7535 !! options
7536 php
7537 !! input
7538 [[Image:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
7539 !! result
7540 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><a href="http://example.com"><img alt="" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Title</div></div></div>
7541
7542 !! end
7543
7544 !! test
7545 Manually-specified thumbnail image with explicit no link
7546 !! options
7547 php
7548 !! input
7549 [[Image:Foobar.jpg|thumb=Thumb.png|link=|Title]]
7550 !! result
7551 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><img alt="" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Title</div></div></div>
7552
7553 !! end
7554
7555 !! test
7556 Manually-specified thumbnail image with explicit link and alt text
7557 !! options
7558 php
7559 !! input
7560 [[Image:Foobar.jpg|thumb=Thumb.png|link=Main Page|alt=alttext|Title]]
7561 !! result
7562 <div class="thumb tright"><div class="thumbinner" style="width:137px;"><a href="/wiki/Main_Page" title="Main Page"><img alt="alttext" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Title</div></div></div>
7563
7564 !! end
7565
7566 !! test
7567 Image with frame and link
7568 !! input
7569 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
7570 !! result
7571 <div class="thumb tleft"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption">This is a test image <a href="/wiki/Main_Page" title="Main Page">Main Page</a></div></div></div>
7572
7573 !! end
7574
7575 !! test
7576 Image with frame and link and explicit alt
7577 !! input
7578 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
7579 !! result
7580 <div class="thumb tleft"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Altitude" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption">This is a test image <a href="/wiki/Main_Page" title="Main Page">Main Page</a></div></div></div>
7581
7582 !! end
7583
7584 !! test
7585 Image with wiki markup in implicit alt
7586 !! input
7587 [[Image:Foobar.jpg|testing '''bold''' in alt]]
7588 !! result
7589 <p><a href="/wiki/File:Foobar.jpg" class="image" title="testing bold in alt"><img alt="testing bold in alt" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7590 </p>
7591 !! end
7592
7593 !! test
7594 Image with wiki markup in explicit alt
7595 !! input
7596 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
7597 !! result
7598 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="testing bold in alt" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7599 </p>
7600 !! end
7601
7602 !! test
7603 Link to image page- image page normally doesn't exists, hence edit link
7604 Add test with existing image page
7605 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
7606 !! input
7607 [[:Image:test]]
7608 !! result
7609 <p><a href="/index.php?title=File:Test&amp;action=edit&amp;redlink=1" class="new" title="File:Test (page does not exist)">Image:test</a>
7610 </p>
7611 !! end
7612
7613 !! test
7614 bug 18784 Link to non-existent image page with caption should use caption as link text
7615 !! input
7616 [[:Image:test|caption]]
7617 !! result
7618 <p><a href="/index.php?title=File:Test&amp;action=edit&amp;redlink=1" class="new" title="File:Test (page does not exist)">caption</a>
7619 </p>
7620 !! end
7621
7622 !! test
7623 Frameless image caption with a free URL
7624 !! input
7625 [[Image:foobar.jpg|http://example.com]]
7626 !! result
7627 <p><a href="/wiki/File:Foobar.jpg" class="image" title="http://example.com"><img alt="http://example.com" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7628 </p>
7629 !! end
7630
7631 !! test
7632 Thumbnail image caption with a free URL
7633 !! input
7634 [[Image:foobar.jpg|thumb|http://example.com]]
7635 !! result
7636 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div></div></div>
7637
7638 !! end
7639
7640 !! test
7641 Thumbnail image caption with a free URL and explicit alt
7642 !! input
7643 [[Image:foobar.jpg|thumb|http://example.com|alt=Alteration]]
7644 !! result
7645 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Alteration" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div></div></div>
7646
7647 !! end
7648
7649 !! test
7650 BUG 1887: A ISBN with a thumbnail
7651 !! input
7652 [[Image:foobar.jpg|thumb|ISBN 1235467890]]
7653 !! result
7654 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div><a href="/wiki/Special:BookSources/1235467890" class="internal mw-magiclink-isbn">ISBN 1235467890</a></div></div></div>
7655
7656 !! end
7657
7658 !! test
7659 BUG 1887: A RFC with a thumbnail
7660 !! input
7661 [[Image:foobar.jpg|thumb|This is RFC 12354]]
7662 !! result
7663 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>This is <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc12354">RFC 12354</a></div></div></div>
7664
7665 !! end
7666
7667 !! test
7668 BUG 1887: A mailto link with a thumbnail
7669 !! input
7670 [[Image:foobar.jpg|thumb|Please mailto:nobody@example.com]]
7671 !! result
7672 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Please <a rel="nofollow" class="external free" href="mailto:nobody@example.com">mailto:nobody@example.com</a></div></div></div>
7673
7674 !! end
7675
7676 # Pending resolution to bug 368
7677 !! test
7678 BUG 648: Frameless image caption with a link
7679 !! input
7680 [[Image:foobar.jpg|text with a [[link]] in it]]
7681 !! result
7682 <p><a href="/wiki/File:Foobar.jpg" class="image" title="text with a link in it"><img alt="text with a link in it" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7683 </p>
7684 !! end
7685
7686 !! test
7687 BUG 648: Frameless image caption with a link (suffix)
7688 !! input
7689 [[Image:foobar.jpg|text with a [[link]]foo in it]]
7690 !! result
7691 <p><a href="/wiki/File:Foobar.jpg" class="image" title="text with a linkfoo in it"><img alt="text with a linkfoo in it" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7692 </p>
7693 !! end
7694
7695 !! test
7696 BUG 648: Frameless image caption with an interwiki link
7697 !! input
7698 [[Image:foobar.jpg|text with a [[MeatBall:Link]] in it]]
7699 !! result
7700 <p><a href="/wiki/File:Foobar.jpg" class="image" title="text with a MeatBall:Link in it"><img alt="text with a MeatBall:Link in it" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7701 </p>
7702 !! end
7703
7704 !! test
7705 BUG 648: Frameless image caption with a piped interwiki link
7706 !! input
7707 [[Image:foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
7708 !! result
7709 <p><a href="/wiki/File:Foobar.jpg" class="image" title="text with a link in it"><img alt="text with a link in it" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7710 </p>
7711 !! end
7712
7713 !! test
7714 Escape HTML special chars in image alt text
7715 !! input
7716 [[Image:foobar.jpg|& < > "]]
7717 !! result
7718 <p><a href="/wiki/File:Foobar.jpg" class="image" title="&amp; &lt; &gt; &quot;"><img alt="&amp; &lt; &gt; &quot;" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7719 </p>
7720 !! end
7721
7722 !! test
7723 BUG 499: Alt text should have &#1234;, not &amp;1234;
7724 !! input
7725 [[Image:foobar.jpg|&#9792;]]
7726 !! result
7727 <p><a href="/wiki/File:Foobar.jpg" class="image" title="♀"><img alt="♀" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7728 </p>
7729 !! end
7730
7731 !! test
7732 Broken image caption with link
7733 !! input
7734 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
7735 !! result
7736 <p>[[Image:Foobar.jpg|thumb|This is a broken caption. But <a href="/wiki/Main_Page" title="Main Page">this</a> is just an ordinary link.
7737 </p>
7738 !! end
7739
7740 !! test
7741 Image caption containing another image
7742 !! input
7743 [[Image:Foobar.jpg|thumb|This is a caption with another [[Image:icon.png|image]] inside it!]]
7744 !! result
7745 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>This is a caption with another <a href="/index.php?title=Special:Upload&amp;wpDestFile=Icon.png" class="new" title="File:Icon.png">image</a> inside it!</div></div></div>
7746
7747 !! end
7748
7749 !! test
7750 Image caption containing a newline
7751 !! input
7752 [[Image:Foobar.jpg|This
7753 *is some text]]
7754 !! result
7755 <p><a href="/wiki/File:Foobar.jpg" class="image" title="This *is some text"><img alt="This *is some text" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
7756 </p>
7757 !!end
7758
7759 !!test
7760 Parsoid: Image caption containing leading space
7761 (The leading space should not trigger nowiki escaping in wt2wt mode)
7762 !! input
7763 [[Image:Foobar.jpg|thumb| bar]]
7764 !! result
7765 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>bar</div></div></div>
7766
7767 !!end
7768
7769 !! test
7770 Bug 3090: External links other than http: in image captions
7771 !! input
7772 [[Image:Foobar.jpg|thumb|200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
7773 !! result
7774 <div class="thumb tright"><div class="thumbinner" style="width:202px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>This caption has <a rel="nofollow" class="external text" href="irc://example.net">irc</a> and <a rel="nofollow" class="external text" href="https://example.com">Secure</a> ext links in it.</div></div></div>
7775
7776 !! end
7777
7778 !! test
7779 Custom class
7780 !! input
7781 [[Image:foobar.jpg|a|class=b]]
7782 !! result
7783 <p><a href="/wiki/File:Foobar.jpg" class="image" title="a"><img alt="a" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="b" /></a>
7784 </p>
7785 !! end
7786
7787 !! test
7788 Localized image handling (1).
7789 !! options
7790 language=es
7791 !! input
7792 [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
7793 !! result
7794 <div class="floatleft"><a href="/wiki/Foo" title="caption"><img alt="caption" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
7795
7796 !! end
7797
7798 !! test
7799 Localized image handling (2).
7800 !! options
7801 language=es
7802 !! input
7803 [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
7804 !! result
7805 <div class="thumb tleft"><div class="thumbinner" style="width:182px;"><a href="/wiki/Foo" title="Foo"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/Archivo:Foobar.jpg" class="internal" title="Aumentar"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>caption</div></div></div>
7806
7807 !! end
7808
7809 !! test
7810 "border", "frameless" and "class" attributes on an image.
7811 !! input
7812 [[File:Foobar.jpg|frameless|border|class=extra|caption]]
7813 !! result
7814 <p><a href="/wiki/File:Foobar.jpg" class="image" title="caption"><img alt="caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="extra thumbborder" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a>
7815 </p>
7816 !! end
7817
7818 !! article
7819 File:Barfoo.jpg
7820 !! text
7821 #REDIRECT [[File:Barfoo.jpg]]
7822 !! endarticle
7823
7824 !! test
7825 Redirected image
7826 !! input
7827 [[Image:Barfoo.jpg]]
7828 !! result
7829 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
7830 </p>
7831 !! end
7832
7833 !! test
7834 Missing image with uploads disabled
7835 !! options
7836 wgEnableUploads=0
7837 !! input
7838 [[Image:Foobaz.jpg]]
7839 !! result
7840 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
7841 </p>
7842 !! end
7843
7844
7845 ###
7846 ### Subpages
7847 ###
7848 !! article
7849 Subpage test/subpage
7850 !! text
7851 foo
7852 !! endarticle
7853
7854 !! test
7855 Subpage link
7856 !! options
7857 subpage title=[[Subpage test]]
7858 !! input
7859 [[/subpage]]
7860 !! result
7861 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
7862 </p>
7863 !! end
7864
7865 !! test
7866 Subpage noslash link
7867 !! options
7868 subpage title=[[Subpage test]]
7869 !!input
7870 [[/subpage/]]
7871 !! result
7872 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
7873 </p>
7874 !! end
7875
7876 !! test
7877 Disabled subpages
7878 !! input
7879 [[/subpage]]
7880 !! result
7881 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
7882 </p>
7883 !! end
7884
7885 !! test
7886 BUG 561: {{/Subpage}}
7887 !! options
7888 subpage title=[[Page]]
7889 !! input
7890 {{/Subpage}}
7891 !! result
7892 <p><a href="/index.php?title=Page/Subpage&amp;action=edit&amp;redlink=1" class="new" title="Page/Subpage (page does not exist)">Page/Subpage</a>
7893 </p>
7894 !! end
7895
7896 ###
7897 ### Categories
7898 ###
7899 !! article
7900 Category:MediaWiki User's Guide
7901 !! text
7902 blah
7903 !! endarticle
7904
7905 !! test
7906 Link to category
7907 !! input
7908 [[:Category:MediaWiki User's Guide]]
7909 !! result
7910 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
7911 </p>
7912 !! end
7913
7914 !! test
7915 Simple category
7916 !! options
7917 cat
7918 !! input
7919 [[Category:MediaWiki User's Guide]]
7920 !! result
7921 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
7922 !! end
7923
7924 !! test
7925 PAGESINCATEGORY invalid title fatal (r33546 fix)
7926 !! input
7927 {{PAGESINCATEGORY:<bogus>}}
7928 !! result
7929 <p>0
7930 </p>
7931 !! end
7932
7933 !! test
7934 Category with different sort key
7935 !! options
7936 cat
7937 !! input
7938 [[Category:MediaWiki User's Guide|Foo]]
7939 !! result
7940 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
7941 !! end
7942
7943 !! test
7944 Category with identical sort key
7945 !! options
7946 cat
7947 !! input
7948 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
7949 !! result
7950 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
7951 !! end
7952
7953 !! test
7954 Category with empty sort key
7955 !! options
7956 cat
7957 pst
7958 !! input
7959 [[Category:MediaWiki User's Guide|]]
7960 !! result
7961 [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
7962 !! end
7963
7964 !! test
7965 Category with empty sort key and parentheses
7966 !! options
7967 cat
7968 pst
7969 !! input
7970 [[Category:Foo (bar)|]]
7971 !! result
7972 [[Category:Foo (bar)|Foo]]
7973 !! end
7974
7975 !! test
7976 Category with link tail
7977 !! options
7978 cat
7979 pst
7980 !! input
7981 123[[Category:Foo]]456
7982 !! result
7983 123[[Category:Foo]]456
7984 !! end
7985
7986 !! test
7987 Category with template
7988 !! options
7989 cat
7990 pst
7991 !! input
7992 [[Category:{{echo|Foo}}]]
7993 !! result
7994 [[Category:{{echo|Foo}}]]
7995 !! end
7996
7997 !! test
7998 Category with template in sort key
7999 !! options
8000 cat
8001 pst
8002 !! input
8003 [[Category:Foo|{{echo|Bar}}]]
8004 !! result
8005 [[Category:Foo|{{echo|Bar}}]]
8006 !! end
8007
8008 !! test
8009 Category with template in sort key and title
8010 !! options
8011 cat
8012 pst
8013 !! input
8014 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
8015 !! result
8016 [[Category:{{echo|Foo}}|{{echo|Bar}}]]
8017 !! end
8018
8019 !! test
8020 Category / paragraph interactions
8021 !! input
8022 Foo [[Category:Baz]] Bar
8023
8024 Foo [[Category:Baz]]
8025 Bar
8026
8027 Foo
8028 [[Category:Baz]]
8029 Bar
8030
8031 Foo
8032 [[Category:Baz]] Bar
8033
8034 Foo
8035 [[Category:Baz]]
8036 [[Category:Baz]]
8037 [[Category:Baz]]
8038 Bar
8039
8040 [[Category:Baz]]
8041 [[Category:Baz]]
8042 [[Category:Baz]]
8043
8044 [[Category:Baz]]
8045 {{echo|[[Category:Baz]]}}
8046 [[Category:Baz]]
8047 !! result
8048 <p>Foo Bar
8049 </p><p>Foo
8050 Bar
8051 </p><p>Foo
8052 Bar
8053 </p><p>Foo Bar
8054 </p><p>Foo
8055 Bar
8056 </p>
8057 !! end
8058
8059 ###
8060 ### Inter-language links
8061 ###
8062 !! test
8063 Inter-language links
8064 !! options
8065 ill
8066 !! input
8067 [[es:Alimento]]
8068 [[fr:Nourriture]]
8069 [[zh:&#39135;&#21697;]]
8070 !! result
8071 es:Alimento fr:Nourriture zh:食品
8072 !! end
8073
8074 !! test
8075 Duplicate interlanguage links (bug 24502)
8076 !! options
8077 ill
8078 !! input
8079 [[es:1]]
8080 [[es:2]]
8081 [[fr:1]]
8082 [[fr:2]]
8083 !! result
8084 es:1 fr:1
8085 !! end
8086
8087 ###
8088 ### Sections
8089 ###
8090 !! test
8091 Basic section headings
8092 !! input
8093 == Headline 1 ==
8094 Some text
8095
8096 ==Headline 2==
8097 More
8098 ===Smaller headline===
8099 Blah blah
8100 !! result
8101 <h2><span class="mw-headline" id="Headline_1">Headline 1</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Headline 1">edit</a>]</span></h2>
8102 <p>Some text
8103 </p>
8104 <h2><span class="mw-headline" id="Headline_2">Headline 2</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Headline 2">edit</a>]</span></h2>
8105 <p>More
8106 </p>
8107 <h3><span class="mw-headline" id="Smaller_headline">Smaller headline</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Smaller headline">edit</a>]</span></h3>
8108 <p>Blah blah
8109 </p>
8110 !! end
8111
8112 !! test
8113 Section headings with TOC
8114 !! input
8115 == Headline 1 ==
8116 === Subheadline 1 ===
8117 ===== Skipping a level =====
8118 ====== Skipping a level ======
8119
8120 == Headline 2 ==
8121 Some text
8122 ===Another headline===
8123 !! result
8124 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8125 <ul>
8126 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
8127 <ul>
8128 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
8129 <ul>
8130 <li class="toclevel-3 tocsection-3"><a href="#Skipping_a_level"><span class="tocnumber">1.1.1</span> <span class="toctext">Skipping a level</span></a>
8131 <ul>
8132 <li class="toclevel-4 tocsection-4"><a href="#Skipping_a_level_2"><span class="tocnumber">1.1.1.1</span> <span class="toctext">Skipping a level</span></a></li>
8133 </ul>
8134 </li>
8135 </ul>
8136 </li>
8137 </ul>
8138 </li>
8139 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
8140 <ul>
8141 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
8142 </ul>
8143 </li>
8144 </ul>
8145 </td></tr></table>
8146 <h2><span class="mw-headline" id="Headline_1">Headline 1</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Headline 1">edit</a>]</span></h2>
8147 <h3><span class="mw-headline" id="Subheadline_1">Subheadline 1</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Subheadline 1">edit</a>]</span></h3>
8148 <h5><span class="mw-headline" id="Skipping_a_level">Skipping a level</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Skipping a level">edit</a>]</span></h5>
8149 <h6><span class="mw-headline" id="Skipping_a_level_2">Skipping a level</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: Skipping a level">edit</a>]</span></h6>
8150 <h2><span class="mw-headline" id="Headline_2">Headline 2</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Headline 2">edit</a>]</span></h2>
8151 <p>Some text
8152 </p>
8153 <h3><span class="mw-headline" id="Another_headline">Another headline</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: Another headline">edit</a>]</span></h3>
8154
8155 !! end
8156
8157 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
8158 !! test
8159 Handling of sections up to level 6 and beyond
8160 !! input
8161 = Level 1 Heading=
8162 == Level 2 Heading==
8163 === Level 3 Heading===
8164 ==== Level 4 Heading====
8165 ===== Level 5 Heading=====
8166 ====== Level 6 Heading======
8167 ======= Level 7 Heading=======
8168 ======== Level 8 Heading========
8169 ========= Level 9 Heading=========
8170 ========== Level 10 Heading==========
8171 !! result
8172 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8173 <ul>
8174 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
8175 <ul>
8176 <li class="toclevel-2 tocsection-2"><a href="#Level_2_Heading"><span class="tocnumber">1.1</span> <span class="toctext">Level 2 Heading</span></a>
8177 <ul>
8178 <li class="toclevel-3 tocsection-3"><a href="#Level_3_Heading"><span class="tocnumber">1.1.1</span> <span class="toctext">Level 3 Heading</span></a>
8179 <ul>
8180 <li class="toclevel-4 tocsection-4"><a href="#Level_4_Heading"><span class="tocnumber">1.1.1.1</span> <span class="toctext">Level 4 Heading</span></a>
8181 <ul>
8182 <li class="toclevel-5 tocsection-5"><a href="#Level_5_Heading"><span class="tocnumber">1.1.1.1.1</span> <span class="toctext">Level 5 Heading</span></a>
8183 <ul>
8184 <li class="toclevel-6 tocsection-6"><a href="#Level_6_Heading"><span class="tocnumber">1.1.1.1.1.1</span> <span class="toctext">Level 6 Heading</span></a></li>
8185 <li class="toclevel-6 tocsection-7"><a href="#.3D_Level_7_Heading.3D"><span class="tocnumber">1.1.1.1.1.2</span> <span class="toctext">= Level 7 Heading=</span></a></li>
8186 <li class="toclevel-6 tocsection-8"><a href="#.3D.3D_Level_8_Heading.3D.3D"><span class="tocnumber">1.1.1.1.1.3</span> <span class="toctext">== Level 8 Heading==</span></a></li>
8187 <li class="toclevel-6 tocsection-9"><a href="#.3D.3D.3D_Level_9_Heading.3D.3D.3D"><span class="tocnumber">1.1.1.1.1.4</span> <span class="toctext">=== Level 9 Heading===</span></a></li>
8188 <li class="toclevel-6 tocsection-10"><a href="#.3D.3D.3D.3D_Level_10_Heading.3D.3D.3D.3D"><span class="tocnumber">1.1.1.1.1.5</span> <span class="toctext">==== Level 10 Heading====</span></a></li>
8189 </ul>
8190 </li>
8191 </ul>
8192 </li>
8193 </ul>
8194 </li>
8195 </ul>
8196 </li>
8197 </ul>
8198 </li>
8199 </ul>
8200 </td></tr></table>
8201 <h1><span class="mw-headline" id="Level_1_Heading">Level 1 Heading</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Level 1 Heading">edit</a>]</span></h1>
8202 <h2><span class="mw-headline" id="Level_2_Heading">Level 2 Heading</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Level 2 Heading">edit</a>]</span></h2>
8203 <h3><span class="mw-headline" id="Level_3_Heading">Level 3 Heading</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Level 3 Heading">edit</a>]</span></h3>
8204 <h4><span class="mw-headline" id="Level_4_Heading">Level 4 Heading</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: Level 4 Heading">edit</a>]</span></h4>
8205 <h5><span class="mw-headline" id="Level_5_Heading">Level 5 Heading</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Level 5 Heading">edit</a>]</span></h5>
8206 <h6><span class="mw-headline" id="Level_6_Heading">Level 6 Heading</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: Level 6 Heading">edit</a>]</span></h6>
8207 <h6><span class="mw-headline" id=".3D_Level_7_Heading.3D">= Level 7 Heading=</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=7" title="Edit section: = Level 7 Heading=">edit</a>]</span></h6>
8208 <h6><span class="mw-headline" id=".3D.3D_Level_8_Heading.3D.3D">== Level 8 Heading==</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=8" title="Edit section: == Level 8 Heading==">edit</a>]</span></h6>
8209 <h6><span class="mw-headline" id=".3D.3D.3D_Level_9_Heading.3D.3D.3D">=== Level 9 Heading===</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=9" title="Edit section: === Level 9 Heading===">edit</a>]</span></h6>
8210 <h6><span class="mw-headline" id=".3D.3D.3D.3D_Level_10_Heading.3D.3D.3D.3D">==== Level 10 Heading====</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=10" title="Edit section: ==== Level 10 Heading====">edit</a>]</span></h6>
8211
8212 !! end
8213
8214 !! test
8215 TOC regression (bug 9764)
8216 !! input
8217 == title 1 ==
8218 === title 1.1 ===
8219 ==== title 1.1.1 ====
8220 === title 1.2 ===
8221 == title 2 ==
8222 === title 2.1 ===
8223 !! result
8224 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8225 <ul>
8226 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
8227 <ul>
8228 <li class="toclevel-2 tocsection-2"><a href="#title_1.1"><span class="tocnumber">1.1</span> <span class="toctext">title 1.1</span></a>
8229 <ul>
8230 <li class="toclevel-3 tocsection-3"><a href="#title_1.1.1"><span class="tocnumber">1.1.1</span> <span class="toctext">title 1.1.1</span></a></li>
8231 </ul>
8232 </li>
8233 <li class="toclevel-2 tocsection-4"><a href="#title_1.2"><span class="tocnumber">1.2</span> <span class="toctext">title 1.2</span></a></li>
8234 </ul>
8235 </li>
8236 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
8237 <ul>
8238 <li class="toclevel-2 tocsection-6"><a href="#title_2.1"><span class="tocnumber">2.1</span> <span class="toctext">title 2.1</span></a></li>
8239 </ul>
8240 </li>
8241 </ul>
8242 </td></tr></table>
8243 <h2><span class="mw-headline" id="title_1">title 1</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: title 1">edit</a>]</span></h2>
8244 <h3><span class="mw-headline" id="title_1.1">title 1.1</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: title 1.1">edit</a>]</span></h3>
8245 <h4><span class="mw-headline" id="title_1.1.1">title 1.1.1</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: title 1.1.1">edit</a>]</span></h4>
8246 <h3><span class="mw-headline" id="title_1.2">title 1.2</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: title 1.2">edit</a>]</span></h3>
8247 <h2><span class="mw-headline" id="title_2">title 2</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: title 2">edit</a>]</span></h2>
8248 <h3><span class="mw-headline" id="title_2.1">title 2.1</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: title 2.1">edit</a>]</span></h3>
8249
8250 !! end
8251
8252 !! test
8253 TOC with wgMaxTocLevel=3 (bug 6204)
8254 !! options
8255 wgMaxTocLevel=3
8256 !! input
8257 == title 1 ==
8258 === title 1.1 ===
8259 ==== title 1.1.1 ====
8260 === title 1.2 ===
8261 == title 2 ==
8262 === title 2.1 ===
8263 !! result
8264 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8265 <ul>
8266 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
8267 <ul>
8268 <li class="toclevel-2 tocsection-2"><a href="#title_1.1"><span class="tocnumber">1.1</span> <span class="toctext">title 1.1</span></a></li>
8269 <li class="toclevel-2 tocsection-4"><a href="#title_1.2"><span class="tocnumber">1.2</span> <span class="toctext">title 1.2</span></a></li>
8270 </ul>
8271 </li>
8272 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
8273 <ul>
8274 <li class="toclevel-2 tocsection-6"><a href="#title_2.1"><span class="tocnumber">2.1</span> <span class="toctext">title 2.1</span></a></li>
8275 </ul>
8276 </li>
8277 </ul>
8278 </td></tr></table>
8279 <h2><span class="mw-headline" id="title_1">title 1</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: title 1">edit</a>]</span></h2>
8280 <h3><span class="mw-headline" id="title_1.1">title 1.1</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: title 1.1">edit</a>]</span></h3>
8281 <h4><span class="mw-headline" id="title_1.1.1">title 1.1.1</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: title 1.1.1">edit</a>]</span></h4>
8282 <h3><span class="mw-headline" id="title_1.2">title 1.2</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: title 1.2">edit</a>]</span></h3>
8283 <h2><span class="mw-headline" id="title_2">title 2</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: title 2">edit</a>]</span></h2>
8284 <h3><span class="mw-headline" id="title_2.1">title 2.1</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: title 2.1">edit</a>]</span></h3>
8285
8286 !! end
8287
8288 !! test
8289 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
8290 !! options
8291 wgMaxTocLevel=3
8292 !! input
8293 ==Section 1==
8294 ===Section 1.1===
8295 ====Section 1.1.1====
8296 ====Section 1.1.1.1====
8297 ==Section 2==
8298 !! result
8299 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8300 <ul>
8301 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
8302 <ul>
8303 <li class="toclevel-2 tocsection-2"><a href="#Section_1.1"><span class="tocnumber">1.1</span> <span class="toctext">Section 1.1</span></a></li>
8304 </ul>
8305 </li>
8306 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
8307 </ul>
8308 </td></tr></table>
8309 <h2><span class="mw-headline" id="Section_1">Section 1</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section 1">edit</a>]</span></h2>
8310 <h3><span class="mw-headline" id="Section_1.1">Section 1.1</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Section 1.1">edit</a>]</span></h3>
8311 <h4><span class="mw-headline" id="Section_1.1.1">Section 1.1.1</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Section 1.1.1">edit</a>]</span></h4>
8312 <h4><span class="mw-headline" id="Section_1.1.1.1">Section 1.1.1.1</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: Section 1.1.1.1">edit</a>]</span></h4>
8313 <h2><span class="mw-headline" id="Section_2">Section 2</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Section 2">edit</a>]</span></h2>
8314
8315 !! end
8316
8317
8318 !! test
8319 Resolving duplicate section names
8320 !! input
8321 == Foo bar ==
8322 == Foo bar ==
8323 !! result
8324 <h2><span class="mw-headline" id="Foo_bar">Foo bar</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Foo bar">edit</a>]</span></h2>
8325 <h2><span class="mw-headline" id="Foo_bar_2">Foo bar</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Foo bar">edit</a>]</span></h2>
8326
8327 !! end
8328
8329 !! test
8330 Resolving duplicate section names with differing case (bug 10721)
8331 !! input
8332 == Foo bar ==
8333 == Foo Bar ==
8334 !! result
8335 <h2><span class="mw-headline" id="Foo_bar">Foo bar</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Foo bar">edit</a>]</span></h2>
8336 <h2><span class="mw-headline" id="Foo_Bar_2">Foo Bar</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Foo Bar">edit</a>]</span></h2>
8337
8338 !! end
8339
8340 !! article
8341 Template:sections
8342 !! text
8343 ===Section 1===
8344 ==Section 2==
8345 !! endarticle
8346
8347 !! test
8348 Template with sections, __NOTOC__
8349 !! input
8350 __NOTOC__
8351 ==Section 0==
8352 {{sections}}
8353 ==Section 4==
8354 !! result
8355 <h2><span class="mw-headline" id="Section_0">Section 0</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section 0">edit</a>]</span></h2>
8356 <h3><span class="mw-headline" id="Section_1">Section 1</span> <span class="mw-editsection">[<a href="/index.php?title=Template:Sections&amp;action=edit&amp;section=T-1" title="Template:Sections">edit</a>]</span></h3>
8357 <h2><span class="mw-headline" id="Section_2">Section 2</span> <span class="mw-editsection">[<a href="/index.php?title=Template:Sections&amp;action=edit&amp;section=T-2" title="Template:Sections">edit</a>]</span></h2>
8358 <h2><span class="mw-headline" id="Section_4">Section 4</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Section 4">edit</a>]</span></h2>
8359
8360 !! end
8361
8362 !! test
8363 __NOEDITSECTION__ keyword
8364 !! input
8365 __NOEDITSECTION__
8366 ==Section 1==
8367 ==Section 2==
8368 !! result
8369 <h2><span class="mw-headline" id="Section_1">Section 1</span> </h2>
8370 <h2><span class="mw-headline" id="Section_2">Section 2</span> </h2>
8371
8372 !! end
8373
8374 !! test
8375 Link inside a section heading
8376 !! input
8377 ==Section with a [[Main Page|link]] in it==
8378 !! result
8379 <h2><span class="mw-headline" id="Section_with_a_link_in_it">Section with a <a href="/wiki/Main_Page" title="Main Page">link</a> in it</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section with a link in it">edit</a>]</span></h2>
8380
8381 !! end
8382
8383 !! test
8384 TOC regression (bug 12077)
8385 !! input
8386 __TOC__
8387 == title 1 ==
8388 === title 1.1 ===
8389 == title 2 ==
8390 !! result
8391 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8392 <ul>
8393 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
8394 <ul>
8395 <li class="toclevel-2 tocsection-2"><a href="#title_1.1"><span class="tocnumber">1.1</span> <span class="toctext">title 1.1</span></a></li>
8396 </ul>
8397 </li>
8398 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
8399 </ul>
8400 </td></tr></table>
8401 <h2><span class="mw-headline" id="title_1">title 1</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: title 1">edit</a>]</span></h2>
8402 <h3><span class="mw-headline" id="title_1.1">title 1.1</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: title 1.1">edit</a>]</span></h3>
8403 <h2><span class="mw-headline" id="title_2">title 2</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: title 2">edit</a>]</span></h2>
8404
8405 !! end
8406
8407 !! test
8408 BUG 1219 URL next to image (good)
8409 !! input
8410 http://example.com [[Image:foobar.jpg]]
8411 !! result
8412 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> <a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
8413 </p>
8414 !!end
8415
8416 !! test
8417 Short headings with trailing space should match behavior of Parser::doHeadings (bug 19910)
8418 !! input
8419 ===
8420 The line above must have a trailing space!
8421 === <!--
8422 --> <!-- -->
8423 But just in case it doesn't...
8424 !! result
8425 <h1><span class="mw-headline" id=".3D">=</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: =">edit</a>]</span></h1>
8426 <p>The line above must have a trailing space!
8427 </p>
8428 <h1><span class="mw-headline" id=".3D_2">=</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: =">edit</a>]</span></h1>
8429 <p>But just in case it doesn't...
8430 </p>
8431 !! end
8432
8433 !! test
8434 Header with special characters (bug 25462)
8435 !! input
8436 The tooltips shall not show entities to the user (ie. be double escaped)
8437
8438 == text > text ==
8439 section 1
8440
8441 == text < text ==
8442 section 2
8443
8444 == text & text ==
8445 section 3
8446
8447 == text ' text ==
8448 section 4
8449
8450 == text " text ==
8451 section 5
8452 !! result
8453 <p>The tooltips shall not show entities to the user (ie. be double escaped)
8454 </p>
8455 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8456 <ul>
8457 <li class="toclevel-1 tocsection-1"><a href="#text_.3E_text"><span class="tocnumber">1</span> <span class="toctext">text &gt; text</span></a></li>
8458 <li class="toclevel-1 tocsection-2"><a href="#text_.3C_text"><span class="tocnumber">2</span> <span class="toctext">text &lt; text</span></a></li>
8459 <li class="toclevel-1 tocsection-3"><a href="#text_.26_text"><span class="tocnumber">3</span> <span class="toctext">text &amp; text</span></a></li>
8460 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
8461 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
8462 </ul>
8463 </td></tr></table>
8464 <h2><span class="mw-headline" id="text_.3E_text">text &gt; text</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: text > text">edit</a>]</span></h2>
8465 <p>section 1
8466 </p>
8467 <h2><span class="mw-headline" id="text_.3C_text">text &lt; text</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: text &lt; text">edit</a>]</span></h2>
8468 <p>section 2
8469 </p>
8470 <h2><span class="mw-headline" id="text_.26_text">text &amp; text</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: text &amp; text">edit</a>]</span></h2>
8471 <p>section 3
8472 </p>
8473 <h2><span class="mw-headline" id="text_.27_text">text ' text</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: text ' text">edit</a>]</span></h2>
8474 <p>section 4
8475 </p>
8476 <h2><span class="mw-headline" id="text_.22_text">text " text</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: text &quot; text">edit</a>]</span></h2>
8477 <p>section 5
8478 </p>
8479 !! end
8480
8481 !! test
8482 Headers with excess '=' characters
8483 (Are similar tests necessary beyond the 1st level?)
8484 !! input
8485 =foo==
8486 ==foo=
8487 =''italic'' heading==
8488 ==''italic'' heading=
8489 !! result
8490 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8491 <ul>
8492 <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
8493 <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
8494 <li class="toclevel-1 tocsection-3"><a href="#italic_heading.3D"><span class="tocnumber">3</span> <span class="toctext"><i>italic</i> heading=</span></a></li>
8495 <li class="toclevel-1 tocsection-4"><a href="#.3Ditalic_heading"><span class="tocnumber">4</span> <span class="toctext">=<i>italic</i> heading</span></a></li>
8496 </ul>
8497 </td></tr></table>
8498 <h1><span class="mw-headline" id="foo.3D">foo=</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: foo=">edit</a>]</span></h1>
8499 <h1><span class="mw-headline" id=".3Dfoo">=foo</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: =foo">edit</a>]</span></h1>
8500 <h1><span class="mw-headline" id="italic_heading.3D"><i>italic</i> heading=</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: italic heading=">edit</a>]</span></h1>
8501 <h1><span class="mw-headline" id=".3Ditalic_heading">=<i>italic</i> heading</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: =italic heading">edit</a>]</span></h1>
8502
8503 !! end
8504
8505 !! test
8506 HTML headers vs TOC (bug 23393)
8507 (__NOEDITSECTION__ for clearer output, doesn't matter here)
8508 !! input
8509 <h1>Header 1</h1>
8510 == Header 1.1 ==
8511 == Header 1.2 ==
8512
8513 <h1>Header 2
8514 </h1>
8515 == Header 2.1 ==
8516 == Header 2.2 ==
8517 __NOEDITSECTION__
8518 !! result
8519 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
8520 <ul>
8521 <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
8522 <ul>
8523 <li class="toclevel-2 tocsection-1"><a href="#Header_1.1"><span class="tocnumber">1.1</span> <span class="toctext">Header 1.1</span></a></li>
8524 <li class="toclevel-2 tocsection-2"><a href="#Header_1.2"><span class="tocnumber">1.2</span> <span class="toctext">Header 1.2</span></a></li>
8525 </ul>
8526 </li>
8527 <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
8528 <ul>
8529 <li class="toclevel-2 tocsection-3"><a href="#Header_2.1"><span class="tocnumber">2.1</span> <span class="toctext">Header 2.1</span></a></li>
8530 <li class="toclevel-2 tocsection-4"><a href="#Header_2.2"><span class="tocnumber">2.2</span> <span class="toctext">Header 2.2</span></a></li>
8531 </ul>
8532 </li>
8533 </ul>
8534 </td></tr></table>
8535 <h1><span class="mw-headline" id="Header_1">Header 1</span> </h1>
8536 <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span> </h2>
8537 <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span> </h2>
8538 <h1><span class="mw-headline" id="Header_2">Header 2</span> </h1>
8539 <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span> </h2>
8540 <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span> </h2>
8541
8542 !! end
8543
8544 !! test
8545 BUG 1219 URL next to image (broken)
8546 !! input
8547 http://example.com[[Image:foobar.jpg]]
8548 !! result
8549 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
8550 </p>
8551 !!end
8552
8553 !! test
8554 Bug 1186 news: in the middle of text
8555 !! input
8556 http://en.wikinews.org/wiki/Wikinews:Workplace
8557 !! result
8558 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
8559 </p>
8560 !!end
8561
8562
8563 !! test
8564 Namespaced link must have a title
8565 !! input
8566 [[Project:]]
8567 !! result
8568 <p>[[Project:]]
8569 </p>
8570 !!end
8571
8572 !! test
8573 Namespaced link must have a title (bad fragment version)
8574 !! input
8575 [[Project:#fragment]]
8576 !! result
8577 <p>[[Project:#fragment]]
8578 </p>
8579 !!end
8580
8581
8582 ###
8583 ### HTML tags and HTML attributes
8584 ###
8585
8586 !! test
8587 div with no attributes
8588 !! input
8589 <div>HTML rocks</div>
8590 !! result
8591 <div>HTML rocks</div>
8592
8593 !! end
8594
8595 !! test
8596 div with double-quoted attribute
8597 !! input
8598 <div id="rock">HTML rocks</div>
8599 !! result
8600 <div id="rock">HTML rocks</div>
8601
8602 !! end
8603
8604 !! test
8605 div with single-quoted attribute
8606 !! input
8607 <div id='rock'>HTML rocks</div>
8608 !! result
8609 <div id="rock">HTML rocks</div>
8610
8611 !! end
8612
8613 !! test
8614 div with unquoted attribute
8615 !! input
8616 <div id=rock>HTML rocks</div>
8617 !! result
8618 <div id="rock">HTML rocks</div>
8619
8620 !! end
8621
8622 !! test
8623 div with illegal double attributes
8624 !! input
8625 <div id="a" id="b">HTML rocks</div>
8626 !! result
8627 <div id="b">HTML rocks</div>
8628
8629 !!end
8630
8631 # FIXME: produce empty string instead of "class" in the PHP parser, following
8632 # the HTML5 spec.
8633 !! test
8634 div with empty attribute value, space before equals
8635 !! options
8636 parsoid
8637 !! input
8638 <div class =>HTML rocks</div>
8639 !! result
8640 <div class="">HTML rocks</div>
8641
8642 !! end
8643
8644 # The PHP parser escapes the opening brace to &#123; for some reason, so
8645 # disabled this test for it.
8646 !! test
8647 div with braces in attribute value
8648 !! options
8649 parsoid
8650 !! input
8651 <div title="{}">Foo</div>
8652 !! result
8653 <div title="{}">Foo</div>
8654 !! end
8655
8656 # This it very inconsistent in the PHP parser: it returns
8657 # class="class" if there is a space between the name and the equal sign (see
8658 # 'div with empty attribute value, space before equals'), but strips the
8659 # attribute completely if the space is missing. We hope that not much content
8660 # depends on this, so are implementing the behavior below in Parsoid for
8661 # consistencies' sake. Disabled for the PHP parser.
8662 # FIXME: fix this behavior in the PHP parser?
8663 !! test
8664 div with empty attribute value, no space before equals
8665 !! options
8666 parsoid
8667 !! input
8668 <div class=>HTML rocks</div>
8669 !! result
8670 <div class="">HTML rocks</div>
8671
8672 !! end
8673
8674 !! test
8675 HTML multiple attributes correction
8676 !! input
8677 <p class="error" class="awesome">Awesome!</p>
8678 !! result
8679 <p class="awesome">Awesome!</p>
8680
8681 !!end
8682
8683 !! test
8684 Table multiple attributes correction
8685 !! input
8686 {|
8687 !+ class="error" class="awesome"| status
8688 |}
8689 !! result
8690 <table>
8691 <tr>
8692 <th class="awesome"> status
8693 </th></tr></table>
8694
8695 !!end
8696
8697 !! test
8698 DIV IN UPPERCASE
8699 !! input
8700 <DIV ID="x">HTML ROCKS</DIV>
8701 !! result
8702 <div id="x">HTML ROCKS</div>
8703
8704 !!end
8705
8706 !! test
8707 Non-ASCII pseudo-tags are rendered as text
8708 !! input
8709 <khyô>
8710 !! result
8711 <p>&lt;khyô&gt;
8712 </p>
8713 !! end
8714
8715 !! test
8716 Pseudo-tag with URL 'name' renders as url link
8717 !! input
8718 <http://example.com/>
8719 !! result
8720 <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
8721 </p>
8722 !! end
8723
8724 !! test
8725 text with amp in the middle of nowhere
8726 !! input
8727 Remember AT&T?
8728 !!result
8729 <p>Remember AT&amp;T?
8730 </p>
8731 !! end
8732
8733 !! test
8734 text with character entity: eacute
8735 !! input
8736 I always thought &eacute; was a cute letter.
8737 !! result
8738 <p>I always thought &#233; was a cute letter.
8739 </p>
8740 !! end
8741
8742 !! test
8743 text with entity-escaped character entity-like string: eacute
8744 !! input
8745 I always thought &amp;eacute; was a cute letter.
8746 !! result
8747 <p>I always thought &amp;eacute; was a cute letter.
8748 </p>
8749 !! end
8750
8751 !! test
8752 text with undefined character entity: xacute
8753 !! input
8754 I always thought &xacute; was a cute letter.
8755 !! result
8756 <p>I always thought &amp;xacute; was a cute letter.
8757 </p>
8758 !! end
8759
8760
8761 ###
8762 ### Media links
8763 ###
8764
8765 !! test
8766 Media link
8767 !! input
8768 [[Media:Foobar.jpg]]
8769 !! result
8770 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
8771 </p>
8772 !! end
8773
8774 !! test
8775 Media link with text
8776 !! input
8777 [[Media:Foobar.jpg|A neat file to look at]]
8778 !! result
8779 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
8780 </p>
8781 !! end
8782
8783 # FIXME: this is still bad HTML tag nesting
8784 !! test
8785 Media link with nasty text
8786 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
8787 !! input
8788 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
8789 !! result
8790 <a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Safe Link&lt;div style="display:none"&gt;" onmouseover="alert(document.cookie)" onfoo="&lt;/div&gt;</a>
8791
8792 !! end
8793
8794 !! test
8795 Media link to nonexistent file (bug 1702)
8796 !! input
8797 [[Media:No such.jpg]]
8798 !! result
8799 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
8800 </p>
8801 !! end
8802
8803 !! test
8804 Image link to nonexistent file (bug 1850 - good)
8805 !! input
8806 [[Image:No such.jpg]]
8807 !! result
8808 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="File:No such.jpg">File:No such.jpg</a>
8809 </p>
8810 !! end
8811
8812 !! test
8813 :Image link to nonexistent file (bug 1850 - bad)
8814 !! input
8815 [[:Image:No such.jpg]]
8816 !! result
8817 <p><a href="/index.php?title=File:No_such.jpg&amp;action=edit&amp;redlink=1" class="new" title="File:No such.jpg (page does not exist)">Image:No such.jpg</a>
8818 </p>
8819 !! end
8820
8821
8822
8823 !! test
8824 Character reference normalization in link text (bug 1938)
8825 !! input
8826 [[Main Page|this&that]]
8827 !! result
8828 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
8829 </p>
8830 !!end
8831
8832 !! article
8833 אַ
8834 !! text
8835 Test for unicode normalization
8836
8837 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
8838 !! endarticle
8839
8840 !! test
8841 (bug 19451) Links should refer to the normalized form.
8842 !! input
8843 [[&#xFB2E;]]
8844 [[&#x5d0;&#x5b7;]]
8845 [[&#x5d0;ַ]]
8846 [[א&#x5b7;]]
8847 [[אַ]]
8848 !! result
8849 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
8850 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
8851 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
8852 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
8853 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
8854 </p>
8855 !! end
8856
8857 !! test
8858 Empty attribute crash test (bug 2067)
8859 !! input
8860 <font color="">foo</font>
8861 !! result
8862 <p><font color="">foo</font>
8863 </p>
8864 !! end
8865
8866 !! test
8867 Empty attribute crash test single-quotes (bug 2067)
8868 !! input
8869 <font color=''>foo</font>
8870 !! result
8871 <p><font color="">foo</font>
8872 </p>
8873 !! end
8874
8875 !! test
8876 Attribute test: equals, then nothing
8877 !! input
8878 <font color=>foo</font>
8879 !! result
8880 <p><font>foo</font>
8881 </p>
8882 !! end
8883
8884 !! test
8885 Attribute test: unquoted value
8886 !! input
8887 <font color=x>foo</font>
8888 !! result
8889 <p><font color="x">foo</font>
8890 </p>
8891 !! end
8892
8893 !! test
8894 Attribute test: unquoted but illegal value (hash)
8895 !! input
8896 <font color=#x>foo</font>
8897 !! result
8898 <p><font color="#x">foo</font>
8899 </p>
8900 !! end
8901
8902 !! test
8903 Attribute test: no value
8904 !! input
8905 <font color>foo</font>
8906 !! result
8907 <p><font color="color">foo</font>
8908 </p>
8909 !! end
8910
8911 !! test
8912 Bug 2095: link with three closing brackets
8913 !! input
8914 [[Main Page]]]
8915 !! result
8916 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
8917 </p>
8918 !! end
8919
8920 !! test
8921 Bug 2095: link with pipe and three closing brackets
8922 !! input
8923 [[Main Page|link]]]
8924 !! result
8925 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
8926 </p>
8927 !! end
8928
8929 !! test
8930 Bug 2095: link with pipe and three closing brackets, version 2
8931 !! input
8932 [[Main Page|[http://example.com/]]]
8933 !! result
8934 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
8935 </p>
8936 !! end
8937
8938
8939 ###
8940 ### Safety
8941 ###
8942
8943 !! article
8944 Template:Dangerous attribute
8945 !! text
8946 " onmouseover="alert(document.cookie)
8947 !! endarticle
8948
8949 !! article
8950 Template:Dangerous style attribute
8951 !! text
8952 border-size: expression(alert(document.cookie))
8953 !! endarticle
8954
8955 !! article
8956 Template:Div style
8957 !! text
8958 <div style="float: right; {{{1}}}">Magic div</div>
8959 !! endarticle
8960
8961 !! test
8962 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
8963 !! input
8964 <div title="{{test}}"></div>
8965 !! result
8966 <div title="This is a test template"></div>
8967
8968 !! end
8969
8970 !! test
8971 Bug 2304: HTML attribute safety (dangerous template; 2309)
8972 !! input
8973 <div title="{{dangerous attribute}}"></div>
8974 !! result
8975 <div title=""></div>
8976
8977 !! end
8978
8979 !! test
8980 Bug 2304: HTML attribute safety (dangerous style template; 2309)
8981 !! input
8982 <div style="{{dangerous style attribute}}"></div>
8983 !! result
8984 <div style="/* insecure input */"></div>
8985
8986 !! end
8987
8988 !! test
8989 Bug 2304: HTML attribute safety (safe parameter; 2309)
8990 !! input
8991 {{div style|width: 200px}}
8992 !! result
8993 <div style="float: right; width: 200px">Magic div</div>
8994
8995 !! end
8996
8997 !! test
8998 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
8999 !! input
9000 {{div style|width: expression(alert(document.cookie))}}
9001 !! result
9002 <div style="/* insecure input */">Magic div</div>
9003
9004 !! end
9005
9006 !! test
9007 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
9008 !! input
9009 {{div style|"><script>alert(document.cookie)</script>}}
9010 !! result
9011 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
9012
9013 !! end
9014
9015 !! test
9016 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
9017 !! input
9018 {{div style|" ><script>alert(document.cookie)</script>}}
9019 !! result
9020 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
9021
9022 !! end
9023
9024 !! test
9025 Bug 2304: HTML attribute safety (link)
9026 !! input
9027 <div title="[[Main Page]]"></div>
9028 !! result
9029 <div title="&#91;&#91;Main Page]]"></div>
9030
9031 !! end
9032
9033 !! test
9034 Bug 2304: HTML attribute safety (italics)
9035 !! input
9036 <div title="''foobar''"></div>
9037 !! result
9038 <div title="&#39;&#39;foobar&#39;&#39;"></div>
9039
9040 !! end
9041
9042 !! test
9043 Bug 2304: HTML attribute safety (bold)
9044 !! input
9045 <div title="'''foobar'''"></div>
9046 !! result
9047 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
9048
9049 !! end
9050
9051
9052 !! test
9053 Bug 2304: HTML attribute safety (ISBN)
9054 !! input
9055 <div title="ISBN 1234567890"></div>
9056 !! result
9057 <div title="&#73;SBN 1234567890"></div>
9058
9059 !! end
9060
9061 !! test
9062 Bug 2304: HTML attribute safety (RFC)
9063 !! input
9064 <div title="RFC 1234"></div>
9065 !! result
9066 <div title="&#82;FC 1234"></div>
9067
9068 !! end
9069
9070 !! test
9071 Bug 2304: HTML attribute safety (PMID)
9072 !! input
9073 <div title="PMID 1234567890"></div>
9074 !! result
9075 <div title="&#80;MID 1234567890"></div>
9076
9077 !! end
9078
9079 !! test
9080 Bug 2304: HTML attribute safety (web link)
9081 !! input
9082 <div title="http://example.com/"></div>
9083 !! result
9084 <div title="http&#58;//example.com/"></div>
9085
9086 !! end
9087
9088 !! test
9089 Bug 2304: HTML attribute safety (named web link)
9090 !! input
9091 <div title="[http://example.com/ link]"></div>
9092 !! result
9093 <div title="&#91;http&#58;//example.com/ link]"></div>
9094
9095 !! end
9096
9097 !! test
9098 Bug 3244: HTML attribute safety (extension; safe)
9099 !! input
9100 <div style="<nowiki>background:blue</nowiki>"></div>
9101 !! result
9102 <div style="background:blue"></div>
9103
9104 !! end
9105
9106 !! test
9107 Bug 3244: HTML attribute safety (extension; unsafe)
9108 !! input
9109 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
9110 !! result
9111 <div style="/* insecure input */"></div>
9112
9113 !! end
9114
9115 # More MSIE fun discovered by Tom Gilder
9116
9117 !! test
9118 MSIE CSS safety test: spurious slash
9119 !! input
9120 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
9121 !! result
9122 <div style="/* insecure input */">evil</div>
9123
9124 !! end
9125
9126 !! test
9127 MSIE CSS safety test: hex code
9128 !! input
9129 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
9130 !! result
9131 <div style="/* insecure input */">evil</div>
9132
9133 !! end
9134
9135 !! test
9136 MSIE CSS safety test: comment in url
9137 !! input
9138 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
9139 !! result
9140 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
9141
9142 !! end
9143
9144 !! test
9145 MSIE CSS safety test: comment in expression
9146 !! input
9147 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
9148 !! result
9149 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
9150
9151 !! end
9152
9153
9154 !! test
9155 Table attribute legitimate extension
9156 !! input
9157 {|
9158 !+ style="<nowiki>color:blue</nowiki>"| status
9159 |}
9160 !! result
9161 <table>
9162 <tr>
9163 <th style="color:blue"> status
9164 </th></tr></table>
9165
9166 !!end
9167
9168 !! test
9169 Table attribute safety
9170 !! input
9171 {|
9172 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
9173 |}
9174 !! result
9175 <table>
9176 <tr>
9177 <th style="/* insecure input */"> status
9178 </th></tr></table>
9179
9180 !! end
9181
9182 !! test
9183 CSS line continuation 1
9184 !! input
9185 <div style="background-image: u\&#10;rl(test.jpg);"></div>
9186 !! result
9187 <div style="/* insecure input */"></div>
9188
9189 !! end
9190
9191 !! test
9192 CSS line continuation 2
9193 !! input
9194 <div style="background-image: u\&#13;rl(test.jpg); "></div>
9195 !! result
9196 <div style="/* insecure input */"></div>
9197
9198 !! end
9199
9200 !! article
9201 Template:Identity
9202 !! text
9203 {{{1}}}
9204 !! endarticle
9205
9206 !! test
9207 Expansion of multi-line templates in attribute values (bug 6255)
9208 !! input
9209 <div style="background: {{identity|#00FF00}}">-</div>
9210 !! result
9211 <div style="background: #00FF00">-</div>
9212
9213 !! end
9214
9215
9216 !! test
9217 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
9218 !! input
9219 <div style="background:
9220 #00FF00">-</div>
9221 !! result
9222 <div style="background: #00FF00">-</div>
9223
9224 !! end
9225
9226 !! test
9227 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
9228 !! input
9229 <div style="background: &#10;#00FF00">-</div>
9230 !! result
9231 <div style="background: &#10;#00FF00">-</div>
9232
9233 !! end
9234
9235 ###
9236 ### Parser hooks (see maintenance/parserTestsParserHook.php for the <tag> extension)
9237 ###
9238 !! test
9239 Parser hook: empty input
9240 !! input
9241 <tag></tag>
9242 !! result
9243 <pre>
9244 ''
9245 array (
9246 )
9247 </pre>
9248
9249 !! end
9250
9251 !! test
9252 Parser hook: empty input using terminated empty elements
9253 !! input
9254 <tag/>
9255 !! result
9256 <pre>
9257 NULL
9258 array (
9259 )
9260 </pre>
9261
9262 !! end
9263
9264 !! test
9265 Parser hook: empty input using terminated empty elements (space before)
9266 !! input
9267 <tag />
9268 !! result
9269 <pre>
9270 NULL
9271 array (
9272 )
9273 </pre>
9274
9275 !! end
9276
9277 !! test
9278 Parser hook: basic input
9279 !! input
9280 <tag>input</tag>
9281 !! result
9282 <pre>
9283 'input'
9284 array (
9285 )
9286 </pre>
9287
9288 !! end
9289
9290
9291 !! test
9292 Parser hook: case insensitive
9293 !! input
9294 <TAG>input</TAG>
9295 !! result
9296 <pre>
9297 'input'
9298 array (
9299 )
9300 </pre>
9301
9302 !! end
9303
9304
9305 !! test
9306 Parser hook: case insensitive, redux
9307 !! input
9308 <TaG>input</TAg>
9309 !! result
9310 <pre>
9311 'input'
9312 array (
9313 )
9314 </pre>
9315
9316 !! end
9317
9318 !! test
9319 Parser hook: nested tags
9320 !! options
9321 noxml
9322 !! input
9323 <tag><tag></tag></tag>
9324 !! result
9325 <pre>
9326 '<tag>'
9327 array (
9328 )
9329 </pre>&lt;/tag&gt;
9330
9331 !! end
9332
9333 !! test
9334 Parser hook: basic arguments
9335 !! input
9336 <tag width=200 height = "100" depth = '50' square></tag>
9337 !! result
9338 <pre>
9339 ''
9340 array (
9341 'width' => '200',
9342 'height' => '100',
9343 'depth' => '50',
9344 'square' => 'square',
9345 )
9346 </pre>
9347
9348 !! end
9349
9350 !! test
9351 Parser hook: argument containing a forward slash (bug 5344)
9352 !! input
9353 <tag filename='/tmp/bla'></tag>
9354 !! result
9355 <pre>
9356 ''
9357 array (
9358 'filename' => '/tmp/bla',
9359 )
9360 </pre>
9361
9362 !! end
9363
9364 !! test
9365 Parser hook: empty input using terminated empty elements (bug 2374)
9366 !! input
9367 <tag foo=bar/>text
9368 !! result
9369 <pre>
9370 NULL
9371 array (
9372 'foo' => 'bar',
9373 )
9374 </pre>text
9375
9376 !! end
9377
9378 # </tag> should be output literally since there is no matching tag that begins it
9379 !! test
9380 Parser hook: basic arguments using terminated empty elements (bug 2374)
9381 !! input
9382 <tag width=200 height = "100" depth = '50' square/>
9383 other stuff
9384 </tag>
9385 !! result
9386 <pre>
9387 NULL
9388 array (
9389 'width' => '200',
9390 'height' => '100',
9391 'depth' => '50',
9392 'square' => 'square',
9393 )
9394 </pre>
9395 <p>other stuff
9396 &lt;/tag&gt;
9397 </p>
9398 !! end
9399
9400 ###
9401 ### (see maintenance/parserTestsStaticParserHook.php for the <statictag> extension)
9402 ###
9403
9404 !! test
9405 Parser hook: static parser hook not inside a comment
9406 !! input
9407 <statictag>hello, world</statictag>
9408 <statictag action=flush/>
9409 !! result
9410 <p>hello, world
9411 </p>
9412 !! end
9413
9414
9415 !! test
9416 Parser hook: static parser hook inside a comment
9417 !! input
9418 <!-- <statictag>hello, world</statictag> -->
9419 <statictag action=flush/>
9420 !! result
9421 <p><br />
9422 </p>
9423 !! end
9424
9425 # Nested template calls; this case was broken by Parser.php rev 1.506,
9426 # since reverted.
9427
9428 !! article
9429 Template:One-parameter
9430 !! text
9431 (My parameter is: {{{1}}})
9432 !! endarticle
9433
9434 !! article
9435 Template:Map-one-parameter
9436 !! text
9437 {{{{{1}}}|{{{2}}}}}
9438 !! endarticle
9439
9440 !! test
9441 Nested template calls
9442 !! input
9443 {{Map-one-parameter|One-parameter|param}}
9444 !! result
9445 <p>(My parameter is: param)
9446 </p>
9447 !! end
9448
9449
9450 ###
9451 ### Sanitizer
9452 ###
9453 !! test
9454 Sanitizer: Closing of open tags
9455 !! input
9456 <s></s><table></table>
9457 !! result
9458 <s></s><table></table>
9459
9460 !! end
9461
9462 !! test
9463 Sanitizer: Closing of open but not closed tags
9464 !! input
9465 <s>foo
9466 !! result
9467 <p><s>foo</s>
9468 </p>
9469 !! end
9470
9471 !! test
9472 Sanitizer: Closing of closed but not open tags
9473 !! input
9474 </s>
9475 !! result
9476 <p>&lt;/s&gt;
9477 </p>
9478 !! end
9479
9480 !! test
9481 Sanitizer: Closing of closed but not open table tags
9482 !! input
9483 Table not started</td></tr></table>
9484 !! result
9485 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
9486 </p>
9487 !! end
9488
9489 !! test
9490 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
9491 !! input
9492 <span id="æ: v">byte</span>[[#æ: v|backlink]]
9493 !! result
9494 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
9495 </p>
9496 !! end
9497
9498 !! test
9499 Sanitizer: Validating the contents of the id attribute (bug 4515)
9500 !! options
9501 disabled
9502 !! input
9503 <br id=9 />
9504 !! result
9505 Something, but definitely not <br id="9" />...
9506 !! end
9507
9508 !! test
9509 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
9510 !! options
9511 disabled
9512 !! input
9513 <br id="foo" /><br id="foo" />
9514 !! result
9515 Something need to be done. foo-2 ?
9516 !! end
9517
9518 !! test
9519 Sanitizer: Validating that <meta> and <link> work, but only for Microdata
9520 !! input
9521 <div itemscope>
9522 <meta itemprop="hello" content="world">
9523 <meta http-equiv="refresh" content="5">
9524 <meta itemprop="hello" http-equiv="refresh" content="5">
9525 <link itemprop="hello" href="{{SERVER}}">
9526 <link rel="stylesheet" href="{{SERVER}}">
9527 <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
9528 </div>
9529 !! result
9530 <div itemscope="itemscope">
9531 <p> <meta itemprop="hello" content="world" />
9532 &lt;meta http-equiv="refresh" content="5"&gt;
9533 <meta itemprop="hello" content="5" />
9534 </p>
9535 <link itemprop="hello" href="http&#58;//example.org" />
9536 &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
9537 <link itemprop="hello" href="http&#58;//example.org" />
9538 </div>
9539
9540 !! end
9541
9542 !! test
9543 Language converter: output gets cut off unexpectedly (bug 5757)
9544 !! options
9545 language=zh
9546 !! input
9547 this bit is safe: }-
9548
9549 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
9550
9551 then we get cut off here: }-
9552
9553 all additional text is vanished
9554 !! result
9555 <p>this bit is safe: }-
9556 </p><p>but if we add a conversion instance: xxx
9557 </p><p>then we get cut off here: }-
9558 </p><p>all additional text is vanished
9559 </p>
9560 !! end
9561
9562 !! test
9563 Self closed html pairs (bug 5487)
9564 !! options
9565 !! input
9566 <center><font id="bug" />Centered text</center>
9567 <div><font id="bug2" />In div text</div>
9568 !! result
9569 <center>&lt;font id="bug" /&gt;Centered text</center>
9570 <div>&lt;font id="bug2" /&gt;In div text</div>
9571
9572 !! end
9573
9574 #
9575 #
9576 #
9577
9578 !! test
9579 Punctuation: nbsp before exclamation
9580 !! input
9581 C'est grave !
9582 !! result
9583 <p>C'est grave&#160;!
9584 </p>
9585 !! end
9586
9587 !! test
9588 Punctuation: CSS !important (bug 11874)
9589 !! input
9590 <div style="width:50% !important">important</div>
9591 !! result
9592 <div style="width:50% !important">important</div>
9593
9594 !!end
9595
9596 !! test
9597 Punctuation: CSS ! important (bug 11874; with space after)
9598 !! input
9599 <div style="width:50% ! important">important</div>
9600 !! result
9601 <div style="width:50% ! important">important</div>
9602
9603 !!end
9604
9605
9606 !! test
9607 HTML bullet list, closed tags (bug 5497)
9608 !! input
9609 <ul>
9610 <li>One</li>
9611 <li>Two</li>
9612 </ul>
9613 !! result
9614 <ul>
9615 <li>One</li>
9616 <li>Two</li>
9617 </ul>
9618
9619 !! end
9620
9621 !! test
9622 HTML bullet list, unclosed tags (bug 5497)
9623 !! options
9624 disabled
9625 !! input
9626 <ul>
9627 <li>One
9628 <li>Two
9629 </ul>
9630 !! result
9631 <ul>
9632 <li>One
9633 </li><li>Two
9634 </li></ul>
9635
9636 !! end
9637
9638 !! test
9639 HTML ordered list, closed tags (bug 5497)
9640 !! input
9641 <ol>
9642 <li>One</li>
9643 <li>Two</li>
9644 </ol>
9645 !! result
9646 <ol>
9647 <li>One</li>
9648 <li>Two</li>
9649 </ol>
9650
9651 !! end
9652
9653 !! test
9654 HTML ordered list, unclosed tags (bug 5497)
9655 !! options
9656 disabled
9657 !! input
9658 <ol>
9659 <li>One
9660 <li>Two
9661 </ol>
9662 !! result
9663 <ol>
9664 <li>One
9665 </li><li>Two
9666 </li></ol>
9667
9668 !! end
9669
9670 !! test
9671 HTML nested bullet list, closed tags (bug 5497)
9672 !! input
9673 <ul>
9674 <li>One</li>
9675 <li>Two:
9676 <ul>
9677 <li>Sub-one</li>
9678 <li>Sub-two</li>
9679 </ul>
9680 </li>
9681 </ul>
9682 !! result
9683 <ul>
9684 <li>One</li>
9685 <li>Two:
9686 <ul>
9687 <li>Sub-one</li>
9688 <li>Sub-two</li>
9689 </ul>
9690 </li>
9691 </ul>
9692
9693 !! end
9694
9695 !! test
9696 HTML nested bullet list, open tags (bug 5497)
9697 !! options
9698 disabled
9699 !! input
9700 <ul>
9701 <li>One
9702 <li>Two:
9703 <ul>
9704 <li>Sub-one
9705 <li>Sub-two
9706 </ul>
9707 </ul>
9708 !! result
9709 <ul>
9710 <li>One
9711 </li><li>Two:
9712 <ul>
9713 <li>Sub-one
9714 </li><li>Sub-two
9715 </li></ul>
9716 </li></ul>
9717
9718 !! end
9719
9720 !! test
9721 HTML nested ordered list, closed tags (bug 5497)
9722 !! input
9723 <ol>
9724 <li>One</li>
9725 <li>Two:
9726 <ol>
9727 <li>Sub-one</li>
9728 <li>Sub-two</li>
9729 </ol>
9730 </li>
9731 </ol>
9732 !! result
9733 <ol>
9734 <li>One</li>
9735 <li>Two:
9736 <ol>
9737 <li>Sub-one</li>
9738 <li>Sub-two</li>
9739 </ol>
9740 </li>
9741 </ol>
9742
9743 !! end
9744
9745 !! test
9746 HTML nested ordered list, open tags (bug 5497)
9747 !! options
9748 disabled
9749 !! input
9750 <ol>
9751 <li>One
9752 <li>Two:
9753 <ol>
9754 <li>Sub-one
9755 <li>Sub-two
9756 </ol>
9757 </ol>
9758 !! result
9759 <ol>
9760 <li>One
9761 </li><li>Two:
9762 <ol>
9763 <li>Sub-one
9764 </li><li>Sub-two
9765 </li></ol>
9766 </li></ol>
9767
9768 !! end
9769
9770 !! test
9771 HTML ordered list item with parameters oddity
9772 !! input
9773 <ol><li id="fragment">One</li></ol>
9774 !! result
9775 <ol><li id="fragment">One</li></ol>
9776
9777 !! end
9778
9779 !!test
9780 bug 5918: autonumbering
9781 !! input
9782 [http://first/] [http://second] [ftp://ftp]
9783
9784 ftp://inlineftp
9785
9786 [mailto:enclosed@mail.tld With target]
9787
9788 [mailto:enclosed@mail.tld]
9789
9790 mailto:inline@mail.tld
9791 !! result
9792 <p><a rel="nofollow" class="external autonumber" href="http://first/">[1]</a> <a rel="nofollow" class="external autonumber" href="http://second">[2]</a> <a rel="nofollow" class="external autonumber" href="ftp://ftp">[3]</a>
9793 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
9794 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
9795 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
9796 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
9797 </p>
9798 !! end
9799
9800
9801 #
9802 # Security and HTML correctness
9803 # From Nick Jenkins' fuzz testing
9804 #
9805
9806 !! test
9807 Fuzz testing: Parser13
9808 !! input
9809 {|
9810 | http://a|
9811 !! result
9812 <table>
9813 <tr>
9814 <td>
9815 </td>
9816 </tr>
9817 </table>
9818
9819 !! end
9820
9821 !! test
9822 Fuzz testing: Parser14
9823 !! input
9824 == onmouseover= ==
9825 http://__TOC__
9826 !! result
9827 <h2><span class="mw-headline" id="onmouseover.3D">onmouseover=</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: onmouseover=">edit</a>]</span></h2>
9828 http://<table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
9829 <ul>
9830 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
9831 </ul>
9832 </td></tr></table>
9833
9834 !! end
9835
9836 !! test
9837 Fuzz testing: Parser14-table
9838 !! input
9839 ==a==
9840 {| STYLE=__TOC__
9841 !! result
9842 <h2><span class="mw-headline" id="a">a</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: a">edit</a>]</span></h2>
9843 <table style="&#95;_TOC&#95;_">
9844 <tr><td></td></tr>
9845 </table>
9846
9847 !! end
9848
9849 # Known to produce bogus xml (extra </td>)
9850 !! test
9851 Fuzz testing: Parser16
9852 !! options
9853 noxml
9854 !! input
9855 {|
9856 !https://||||||
9857 !! result
9858 <table>
9859 <tr>
9860 <th>https://</th>
9861 <th></th>
9862 <th></th>
9863 <th>
9864 </td>
9865 </tr>
9866 </table>
9867
9868 !! end
9869
9870 !! test
9871 Fuzz testing: Parser21
9872 !! input
9873 {|
9874 ! irc://{{ftp://a" onmouseover="alert('hello world');"
9875 |
9876 !! result
9877 <table>
9878 <tr>
9879 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
9880 </th>
9881 <td>
9882 </td>
9883 </tr>
9884 </table>
9885
9886 !! end
9887
9888 !! test
9889 Fuzz testing: Parser22
9890 !! input
9891 http://===r:::https://b
9892
9893 {|
9894 !!result
9895 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
9896 </p>
9897 <table>
9898 <tr><td></td></tr>
9899 </table>
9900
9901 !! end
9902
9903 # Known to produce bad XML for now
9904 !! test
9905 Fuzz testing: Parser24
9906 !! options
9907 noxml
9908 !! input
9909 {|
9910 {{{|
9911 <u CLASS=
9912 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
9913 <br style="onmouseover='alert(document.cookie);' " />
9914
9915 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
9916 |
9917 !! result
9918 <table>
9919 {{{|
9920 <u class="&#124;">}}}} &gt;
9921 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
9922
9923 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
9924 <tr>
9925 <td></u>
9926 </td>
9927 </tr>
9928 </table>
9929
9930 !! end
9931
9932 # Note: the current result listed for this is not what the original one was,
9933 # but the original bug was JavaScript injection, which is fixed in any case.
9934 # It's not clear that the original result listed was any more correct than the
9935 # current one. Original result:
9936 # <p>{{{|
9937 # </p>
9938 # <li class="&#124;&#124;">
9939 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
9940 !!test
9941 Fuzz testing: Parser25 (bug 6055)
9942 !! input
9943 {{{
9944 |
9945 <LI CLASS=||
9946 >
9947 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
9948 !! result
9949 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
9950 </p>
9951 !! end
9952
9953 !!test
9954 Fuzz testing: URL adjacent extension (with space, clean)
9955 !! options
9956 !! input
9957 http://example.com <nowiki>junk</nowiki>
9958 !! result
9959 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
9960 </p>
9961 !!end
9962
9963 !!test
9964 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
9965 !! options
9966 !! input
9967 http://example.com<nowiki>junk</nowiki>
9968 !! result
9969 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
9970 </p>
9971 !!end
9972
9973 !!test
9974 Fuzz testing: URL adjacent extension (no space, dirty; pre)
9975 !! options
9976 !! input
9977 http://example.com<pre>junk</pre>
9978 !! result
9979 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
9980
9981 !!end
9982
9983 !!test
9984 Fuzz testing: image with bogus manual thumbnail
9985 !!input
9986 [[Image:foobar.jpg|thumbnail= ]]
9987 !!result
9988 <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
9989
9990 !!end
9991
9992 !! test
9993 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
9994 !! input
9995 <pre dir="&#10;"></pre>
9996 !! result
9997 <pre dir="&#10;"></pre>
9998
9999 !! end
10000
10001 !! test
10002 Parsing optional HTML elements (Bug 6171)
10003 !! options
10004 !! input
10005 <table>
10006 <tr>
10007 <td> Some tabular data</td>
10008 <td> More tabular data ...
10009 <td> And yet som tabular data</td>
10010 </tr>
10011 </table>
10012 !! result
10013 <table>
10014 <tr>
10015 <td> Some tabular data</td>
10016 <td> More tabular data ...
10017 </td><td> And yet som tabular data</td>
10018 </tr>
10019 </table>
10020
10021 !! end
10022
10023 !! test
10024 Correct handling of <td>, <tr> (Bug 6171)
10025 !! options
10026 !! input
10027 <table>
10028 <tr>
10029 <td> Some tabular data</td>
10030 <td> More tabular data ...</td>
10031 <td> And yet som tabular data</td>
10032 </tr>
10033 </table>
10034 !! result
10035 <table>
10036 <tr>
10037 <td> Some tabular data</td>
10038 <td> More tabular data ...</td>
10039 <td> And yet som tabular data</td>
10040 </tr>
10041 </table>
10042
10043 !! end
10044
10045
10046 !! test
10047 Parsing crashing regression (fr:JavaScript)
10048 !! input
10049 </body></x>
10050 !! result
10051 <p>&lt;/body&gt;&lt;/x&gt;
10052 </p>
10053 !! end
10054
10055 !! test
10056 Inline wiki vs wiki block nesting
10057 !! input
10058 '''Bold paragraph
10059
10060 New wiki paragraph
10061 !! result
10062 <p><b>Bold paragraph</b>
10063 </p><p>New wiki paragraph
10064 </p>
10065 !! end
10066
10067 !! test
10068 Inline HTML vs wiki block nesting
10069 !! options
10070 disabled
10071 !! input
10072 <b>Bold paragraph
10073
10074 New wiki paragraph
10075 !! result
10076 <p><b>Bold paragraph</b>
10077 </p><p>New wiki paragraph
10078 </p>
10079 !! end
10080
10081 # Original result was this:
10082 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
10083 # </p>
10084 # While that might be marginally more intuitive, maybe, the six-apostrophe
10085 # construct is clearly pathological and the result stated here (which is what
10086 # the parser actually does) is about as reasonable as anything.
10087 !!test
10088 Mixing markup for italics and bold
10089 !! options
10090 !! input
10091 '''bold''''''bold''bolditalics'''''
10092 !! result
10093 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
10094 </p>
10095 !! end
10096
10097
10098 !! article
10099 Xyzzyx
10100 !! text
10101 Article for special page transclusion test
10102 !! endarticle
10103
10104 !! test
10105 Special page transclusion
10106 !! options
10107 !! input
10108 {{Special:Prefixindex/Xyzzyx}}
10109 !! result
10110 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
10111
10112 !! end
10113
10114 !! test
10115 Special page transclusion twice (bug 5021)
10116 !! options
10117 !! input
10118 {{Special:Prefixindex/Xyzzyx}}
10119 {{Special:Prefixindex/Xyzzyx}}
10120 !! result
10121 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
10122 <table id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
10123
10124 !! end
10125
10126 !! test
10127 Transclusion of default MediaWiki message
10128 !! input
10129 {{MediaWiki:Mainpage}}
10130 !!result
10131 <p>Main Page
10132 </p>
10133 !! end
10134
10135 !! test
10136 Transclusion of nonexistent MediaWiki message
10137 !! input
10138 {{MediaWiki:Mainpagexxx}}
10139 !!result
10140 <p><a href="/index.php?title=MediaWiki:Mainpagexxx&amp;action=edit&amp;redlink=1" class="new" title="MediaWiki:Mainpagexxx (page does not exist)">MediaWiki:Mainpagexxx</a>
10141 </p>
10142 !! end
10143
10144 !! test
10145 Transclusion of MediaWiki message with underscore
10146 !! input
10147 {{MediaWiki:history_short}}
10148 !! result
10149 <p>History
10150 </p>
10151 !! end
10152
10153 !! test
10154 Transclusion of MediaWiki message with space
10155 !! input
10156 {{MediaWiki:history short}}
10157 !! result
10158 <p>History
10159 </p>
10160 !! end
10161
10162 !! test
10163 Invalid header with following text
10164 !! input
10165 = x = y
10166 !! result
10167 <p>= x = y
10168 </p>
10169 !! end
10170
10171
10172 !! test
10173 Section extraction test (section 0)
10174 !! options
10175 section=0
10176 !! input
10177 start
10178 ==a==
10179 ===aa===
10180 ====aaa====
10181 ==b==
10182 ===ba===
10183 ===bb===
10184 ====bba====
10185 ===bc===
10186 ==c==
10187 ===ca===
10188 !! result
10189 start
10190 !! end
10191
10192 !! test
10193 Section extraction test (section 1)
10194 !! options
10195 section=1
10196 !! input
10197 start
10198 ==a==
10199 ===aa===
10200 ====aaa====
10201 ==b==
10202 ===ba===
10203 ===bb===
10204 ====bba====
10205 ===bc===
10206 ==c==
10207 ===ca===
10208 !! result
10209 ==a==
10210 ===aa===
10211 ====aaa====
10212 !! end
10213
10214 !! test
10215 Section extraction test (section 2)
10216 !! options
10217 section=2
10218 !! input
10219 start
10220 ==a==
10221 ===aa===
10222 ====aaa====
10223 ==b==
10224 ===ba===
10225 ===bb===
10226 ====bba====
10227 ===bc===
10228 ==c==
10229 ===ca===
10230 !! result
10231 ===aa===
10232 ====aaa====
10233 !! end
10234
10235 !! test
10236 Section extraction test (section 3)
10237 !! options
10238 section=3
10239 !! input
10240 start
10241 ==a==
10242 ===aa===
10243 ====aaa====
10244 ==b==
10245 ===ba===
10246 ===bb===
10247 ====bba====
10248 ===bc===
10249 ==c==
10250 ===ca===
10251 !! result
10252 ====aaa====
10253 !! end
10254
10255 !! test
10256 Section extraction test (section 4)
10257 !! options
10258 section=4
10259 !! input
10260 start
10261 ==a==
10262 ===aa===
10263 ====aaa====
10264 ==b==
10265 ===ba===
10266 ===bb===
10267 ====bba====
10268 ===bc===
10269 ==c==
10270 ===ca===
10271 !! result
10272 ==b==
10273 ===ba===
10274 ===bb===
10275 ====bba====
10276 ===bc===
10277 !! end
10278
10279 !! test
10280 Section extraction test (section 5)
10281 !! options
10282 section=5
10283 !! input
10284 start
10285 ==a==
10286 ===aa===
10287 ====aaa====
10288 ==b==
10289 ===ba===
10290 ===bb===
10291 ====bba====
10292 ===bc===
10293 ==c==
10294 ===ca===
10295 !! result
10296 ===ba===
10297 !! end
10298
10299 !! test
10300 Section extraction test (section 6)
10301 !! options
10302 section=6
10303 !! input
10304 start
10305 ==a==
10306 ===aa===
10307 ====aaa====
10308 ==b==
10309 ===ba===
10310 ===bb===
10311 ====bba====
10312 ===bc===
10313 ==c==
10314 ===ca===
10315 !! result
10316 ===bb===
10317 ====bba====
10318 !! end
10319
10320 !! test
10321 Section extraction test (section 7)
10322 !! options
10323 section=7
10324 !! input
10325 start
10326 ==a==
10327 ===aa===
10328 ====aaa====
10329 ==b==
10330 ===ba===
10331 ===bb===
10332 ====bba====
10333 ===bc===
10334 ==c==
10335 ===ca===
10336 !! result
10337 ====bba====
10338 !! end
10339
10340 !! test
10341 Section extraction test (section 8)
10342 !! options
10343 section=8
10344 !! input
10345 start
10346 ==a==
10347 ===aa===
10348 ====aaa====
10349 ==b==
10350 ===ba===
10351 ===bb===
10352 ====bba====
10353 ===bc===
10354 ==c==
10355 ===ca===
10356 !! result
10357 ===bc===
10358 !! end
10359
10360 !! test
10361 Section extraction test (section 9)
10362 !! options
10363 section=9
10364 !! input
10365 start
10366 ==a==
10367 ===aa===
10368 ====aaa====
10369 ==b==
10370 ===ba===
10371 ===bb===
10372 ====bba====
10373 ===bc===
10374 ==c==
10375 ===ca===
10376 !! result
10377 ==c==
10378 ===ca===
10379 !! end
10380
10381 !! test
10382 Section extraction test (section 10)
10383 !! options
10384 section=10
10385 !! input
10386 start
10387 ==a==
10388 ===aa===
10389 ====aaa====
10390 ==b==
10391 ===ba===
10392 ===bb===
10393 ====bba====
10394 ===bc===
10395 ==c==
10396 ===ca===
10397 !! result
10398 ===ca===
10399 !! end
10400
10401 !! test
10402 Section extraction test (nonexistent section 11)
10403 !! options
10404 section=11
10405 !! input
10406 start
10407 ==a==
10408 ===aa===
10409 ====aaa====
10410 ==b==
10411 ===ba===
10412 ===bb===
10413 ====bba====
10414 ===bc===
10415 ==c==
10416 ===ca===
10417 !! result
10418 !! end
10419
10420 !! test
10421 Section extraction test with bogus heading (section 1)
10422 !! options
10423 section=1
10424 !! input
10425 ==a==
10426 ==bogus== not a legal section
10427 ==b==
10428 !! result
10429 ==a==
10430 ==bogus== not a legal section
10431 !! end
10432
10433 !! test
10434 Section extraction test with bogus heading (section 2)
10435 !! options
10436 section=2
10437 !! input
10438 ==a==
10439 ==bogus== not a legal section
10440 ==b==
10441 !! result
10442 ==b==
10443 !! end
10444
10445 !! test
10446 Section extraction test with comment after heading (section 1)
10447 !! options
10448 section=1
10449 !! input
10450 ==a==
10451 ==b== <!-- -->
10452 ==c==
10453 !! result
10454 ==a==
10455 !! end
10456
10457 !! test
10458 Section extraction test with comment after heading (section 2)
10459 !! options
10460 section=2
10461 !! input
10462 ==a==
10463 ==b== <!-- -->
10464 ==c==
10465 !! result
10466 ==b== <!-- -->
10467 !! end
10468
10469 !! test
10470 Section extraction test with bogus <nowiki> heading (section 1)
10471 !! options
10472 section=1
10473 !! input
10474 ==a==
10475 ==bogus== <nowiki>not a legal section</nowiki>
10476 ==b==
10477 !! result
10478 ==a==
10479 ==bogus== <nowiki>not a legal section</nowiki>
10480 !! end
10481
10482 !! test
10483 Section extraction test with bogus <nowiki> heading (section 2)
10484 !! options
10485 section=2
10486 !! input
10487 ==a==
10488 ==bogus== <nowiki>not a legal section</nowiki>
10489 ==b==
10490 !! result
10491 ==b==
10492 !! end
10493
10494
10495 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
10496 # instead of respecting commented sections
10497 !! test
10498 Section extraction prefixed by comment (section 1)
10499 !! options
10500 section=1
10501 !! input
10502 <!-- -->==sec1==
10503 ==sec2==
10504 !!result
10505 ==sec2==
10506 !!end
10507
10508 !! test
10509 Section extraction prefixed by comment (section 2)
10510 !! options
10511 section=2
10512 !! input
10513 <!-- -->==sec1==
10514 ==sec2==
10515 !!result
10516
10517 !!end
10518
10519
10520 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
10521 # instead of respecting HTML-style headings
10522 !! test
10523 Section extraction, mixed wiki and html (section 1)
10524 !! options
10525 section=1
10526 !! input
10527 <h2>unmarked</h2>
10528 unmarked
10529 ==1==
10530 one
10531 ==2==
10532 two
10533 !! result
10534 ==1==
10535 one
10536 !! end
10537
10538 !! test
10539 Section extraction, mixed wiki and html (section 2)
10540 !! options
10541 section=2
10542 !! input
10543 <h2>unmarked</h2>
10544 unmarked
10545 ==1==
10546 one
10547 ==2==
10548 two
10549 !! result
10550 ==2==
10551 two
10552 !! end
10553
10554
10555 # Formerly testing for bug 3342
10556 !! test
10557 Section extraction, heading surrounded by <noinclude>
10558 !! options
10559 section=1
10560 !! input
10561 <noinclude>==unmarked==</noinclude>
10562 ==marked==
10563 !! result
10564 ==marked==
10565 !!end
10566
10567 # Test behavior of bug 19910
10568 !! test
10569 Sectiion with all-equals
10570 !! options
10571 section=2
10572 !! input
10573 ===
10574 The line above must have a trailing space
10575 === <!--
10576 --> <!-- -->
10577 But just in case it doesn't...
10578 !! result
10579 === <!--
10580 --> <!-- -->
10581 But just in case it doesn't...
10582 !! end
10583
10584 !! test
10585 Section replacement test (section 0)
10586 !! options
10587 replace=0,"xxx"
10588 !! input
10589 start
10590 ==a==
10591 ===aa===
10592 ====aaa====
10593 ==b==
10594 ===ba===
10595 ===bb===
10596 ====bba====
10597 ===bc===
10598 ==c==
10599 ===ca===
10600 !! result
10601 xxx
10602
10603 ==a==
10604 ===aa===
10605 ====aaa====
10606 ==b==
10607 ===ba===
10608 ===bb===
10609 ====bba====
10610 ===bc===
10611 ==c==
10612 ===ca===
10613 !! end
10614
10615 !! test
10616 Section replacement test (section 1)
10617 !! options
10618 replace=1,"xxx"
10619 !! input
10620 start
10621 ==a==
10622 ===aa===
10623 ====aaa====
10624 ==b==
10625 ===ba===
10626 ===bb===
10627 ====bba====
10628 ===bc===
10629 ==c==
10630 ===ca===
10631 !! result
10632 start
10633 xxx
10634
10635 ==b==
10636 ===ba===
10637 ===bb===
10638 ====bba====
10639 ===bc===
10640 ==c==
10641 ===ca===
10642 !! end
10643
10644 !! test
10645 Section replacement test (section 2)
10646 !! options
10647 replace=2,"xxx"
10648 !! input
10649 start
10650 ==a==
10651 ===aa===
10652 ====aaa====
10653 ==b==
10654 ===ba===
10655 ===bb===
10656 ====bba====
10657 ===bc===
10658 ==c==
10659 ===ca===
10660 !! result
10661 start
10662 ==a==
10663 xxx
10664
10665 ==b==
10666 ===ba===
10667 ===bb===
10668 ====bba====
10669 ===bc===
10670 ==c==
10671 ===ca===
10672 !! end
10673
10674 !! test
10675 Section replacement test (section 3)
10676 !! options
10677 replace=3,"xxx"
10678 !! input
10679 start
10680 ==a==
10681 ===aa===
10682 ====aaa====
10683 ==b==
10684 ===ba===
10685 ===bb===
10686 ====bba====
10687 ===bc===
10688 ==c==
10689 ===ca===
10690 !! result
10691 start
10692 ==a==
10693 ===aa===
10694 xxx
10695
10696 ==b==
10697 ===ba===
10698 ===bb===
10699 ====bba====
10700 ===bc===
10701 ==c==
10702 ===ca===
10703 !! end
10704
10705 !! test
10706 Section replacement test (section 4)
10707 !! options
10708 replace=4,"xxx"
10709 !! input
10710 start
10711 ==a==
10712 ===aa===
10713 ====aaa====
10714 ==b==
10715 ===ba===
10716 ===bb===
10717 ====bba====
10718 ===bc===
10719 ==c==
10720 ===ca===
10721 !! result
10722 start
10723 ==a==
10724 ===aa===
10725 ====aaa====
10726 xxx
10727
10728 ==c==
10729 ===ca===
10730 !! end
10731
10732 !! test
10733 Section replacement test (section 5)
10734 !! options
10735 replace=5,"xxx"
10736 !! input
10737 start
10738 ==a==
10739 ===aa===
10740 ====aaa====
10741 ==b==
10742 ===ba===
10743 ===bb===
10744 ====bba====
10745 ===bc===
10746 ==c==
10747 ===ca===
10748 !! result
10749 start
10750 ==a==
10751 ===aa===
10752 ====aaa====
10753 ==b==
10754 xxx
10755
10756 ===bb===
10757 ====bba====
10758 ===bc===
10759 ==c==
10760 ===ca===
10761 !! end
10762
10763 !! test
10764 Section replacement test (section 6)
10765 !! options
10766 replace=6,"xxx"
10767 !! input
10768 start
10769 ==a==
10770 ===aa===
10771 ====aaa====
10772 ==b==
10773 ===ba===
10774 ===bb===
10775 ====bba====
10776 ===bc===
10777 ==c==
10778 ===ca===
10779 !! result
10780 start
10781 ==a==
10782 ===aa===
10783 ====aaa====
10784 ==b==
10785 ===ba===
10786 xxx
10787
10788 ===bc===
10789 ==c==
10790 ===ca===
10791 !! end
10792
10793 !! test
10794 Section replacement test (section 7)
10795 !! options
10796 replace=7,"xxx"
10797 !! input
10798 start
10799 ==a==
10800 ===aa===
10801 ====aaa====
10802 ==b==
10803 ===ba===
10804 ===bb===
10805 ====bba====
10806 ===bc===
10807 ==c==
10808 ===ca===
10809 !! result
10810 start
10811 ==a==
10812 ===aa===
10813 ====aaa====
10814 ==b==
10815 ===ba===
10816 ===bb===
10817 xxx
10818
10819 ===bc===
10820 ==c==
10821 ===ca===
10822 !! end
10823
10824 !! test
10825 Section replacement test (section 8)
10826 !! options
10827 replace=8,"xxx"
10828 !! input
10829 start
10830 ==a==
10831 ===aa===
10832 ====aaa====
10833 ==b==
10834 ===ba===
10835 ===bb===
10836 ====bba====
10837 ===bc===
10838 ==c==
10839 ===ca===
10840 !! result
10841 start
10842 ==a==
10843 ===aa===
10844 ====aaa====
10845 ==b==
10846 ===ba===
10847 ===bb===
10848 ====bba====
10849 xxx
10850
10851 ==c==
10852 ===ca===
10853 !!end
10854
10855 !! test
10856 Section replacement test (section 9)
10857 !! options
10858 replace=9,"xxx"
10859 !! input
10860 start
10861 ==a==
10862 ===aa===
10863 ====aaa====
10864 ==b==
10865 ===ba===
10866 ===bb===
10867 ====bba====
10868 ===bc===
10869 ==c==
10870 ===ca===
10871 !! result
10872 start
10873 ==a==
10874 ===aa===
10875 ====aaa====
10876 ==b==
10877 ===ba===
10878 ===bb===
10879 ====bba====
10880 ===bc===
10881 xxx
10882 !! end
10883
10884 !! test
10885 Section replacement test (section 10)
10886 !! options
10887 replace=10,"xxx"
10888 !! input
10889 start
10890 ==a==
10891 ===aa===
10892 ====aaa====
10893 ==b==
10894 ===ba===
10895 ===bb===
10896 ====bba====
10897 ===bc===
10898 ==c==
10899 ===ca===
10900 !! result
10901 start
10902 ==a==
10903 ===aa===
10904 ====aaa====
10905 ==b==
10906 ===ba===
10907 ===bb===
10908 ====bba====
10909 ===bc===
10910 ==c==
10911 xxx
10912 !! end
10913
10914 !! test
10915 Section replacement test with initial whitespace (bug 13728)
10916 !! options
10917 replace=2,"xxx"
10918 !! input
10919 Preformatted initial line
10920 ==a==
10921 ===a===
10922 !! result
10923 Preformatted initial line
10924 ==a==
10925 xxx
10926 !! end
10927
10928
10929 !! test
10930 Section extraction, heading followed by pre with 20 spaces (bug 6398)
10931 !! options
10932 section=1
10933 !! input
10934 ==a==
10935 a
10936 !! result
10937 ==a==
10938 a
10939 !! end
10940
10941 !! test
10942 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
10943 !! options
10944 section=1
10945 !! input
10946 ==a==
10947 a
10948 !! result
10949 ==a==
10950 a
10951 !! end
10952
10953
10954 !! test
10955 Section extraction, <pre> around bogus header (bug 10309)
10956 !! options
10957 noxml section=2
10958 !! input
10959 == Section One ==
10960 <pre>
10961 =======
10962 </pre>
10963
10964 == Section Two ==
10965 stuff
10966 !! result
10967 == Section Two ==
10968 stuff
10969 !! end
10970
10971 !! test
10972 Section replacement, <pre> around bogus header (bug 10309)
10973 !! options
10974 noxml replace=2,"xxx"
10975 !! input
10976 == Section One ==
10977 <pre>
10978 =======
10979 </pre>
10980
10981 == Section Two ==
10982 stuff
10983 !! result
10984 == Section One ==
10985 <pre>
10986 =======
10987 </pre>
10988
10989 xxx
10990 !! end
10991
10992
10993
10994 !! test
10995 Handling of &#x0A; in URLs
10996 !! input
10997 **irc://&#x0A;a
10998 !! result
10999 <ul><li><ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a>
11000 </li></ul>
11001 </li></ul>
11002
11003 !!end
11004
11005 !! test
11006 5 quotes, code coverage +1 line (php)
11007 !! options
11008 php
11009 !! input
11010 '''''
11011 !! result
11012 !! end
11013 # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
11014 !! test
11015 5 quotes, code coverage +1 line (parsoid)
11016 !! options
11017 parsoid
11018 !! input
11019 '''''
11020 !! result
11021 <p><i><b></b></i></p>
11022 !! end
11023
11024 !! test
11025 Special:Search page linking.
11026 !! input
11027 {{Special:search}}
11028 !! result
11029 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
11030 </p>
11031 !! end
11032
11033 !! test
11034 Say the magic word
11035 !! input
11036 * {{PAGENAME}}
11037 * {{BASEPAGENAME}}
11038 * {{SUBPAGENAME}}
11039 * {{SUBPAGENAMEE}}
11040 * {{ROOTPAGENAME}}
11041 * {{ROOTPAGENAMEE}}
11042 * {{BASEPAGENAME}}
11043 * {{BASEPAGENAMEE}}
11044 * {{TALKPAGENAME}}
11045 * {{TALKPAGENAMEE}}
11046 * {{SUBJECTPAGENAME}}
11047 * {{SUBJECTPAGENAMEE}}
11048 * {{NAMESPACEE}}
11049 * {{NAMESPACE}}
11050 * {{TALKSPACE}}
11051 * {{TALKSPACEE}}
11052 * {{SUBJECTSPACE}}
11053 * {{SUBJECTSPACEE}}
11054 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
11055 !! result
11056 <ul><li> Parser test
11057 </li><li> Parser test
11058 </li><li> Parser test
11059 </li><li> Parser_test
11060 </li><li> Parser test
11061 </li><li> Parser_test
11062 </li><li> Parser test
11063 </li><li> Parser_test
11064 </li><li> Talk:Parser test
11065 </li><li> Talk:Parser_test
11066 </li><li> Parser test
11067 </li><li> Parser_test
11068 </li><li>
11069 </li><li>
11070 </li><li> Talk
11071 </li><li> Talk
11072 </li><li>
11073 </li><li>
11074 </li><li> <a href="/index.php?title=Template:Dynamic&amp;action=edit&amp;redlink=1" class="new" title="Template:Dynamic (page does not exist)">Template:Dynamic</a>
11075 </li></ul>
11076
11077 !! end
11078 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
11079
11080 !! test
11081 Gallery
11082 !! input
11083 <gallery>
11084 image1.png |
11085 image2.gif|||||
11086
11087 image3|
11088 image4 |300px| centre
11089 image5.svg| http://///////
11090 [[x|xx]]]]
11091 * image6
11092 </gallery>
11093 !! result
11094 <ul class="gallery">
11095 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11096 <div style="height: 150px;">Image1.png</div>
11097 <div class="gallerytext">
11098 </div>
11099 </div></li>
11100 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11101 <div style="height: 150px;">Image2.gif</div>
11102 <div class="gallerytext">
11103 <p>||||
11104 </p>
11105 </div>
11106 </div></li>
11107 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11108 <div style="height: 150px;">Image3</div>
11109 <div class="gallerytext">
11110 </div>
11111 </div></li>
11112 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11113 <div style="height: 150px;">Image4</div>
11114 <div class="gallerytext">
11115 <p>300px| centre
11116 </p>
11117 </div>
11118 </div></li>
11119 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11120 <div style="height: 150px;">Image5.svg</div>
11121 <div class="gallerytext">
11122 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
11123 </p>
11124 </div>
11125 </div></li>
11126 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11127 <div style="height: 150px;">* image6</div>
11128 <div class="gallerytext">
11129 </div>
11130 </div></li>
11131 </ul>
11132
11133 !! end
11134
11135 !! test
11136 Gallery (with options)
11137 !! input
11138 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
11139 File:Nonexistant.jpg|caption
11140 File:Nonexistant.jpg
11141 image:foobar.jpg|some '''caption''' [[Main Page]]
11142 image:foobar.jpg
11143 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
11144 </gallery>
11145 !! result
11146 <ul class="gallery" style="max-width: 226px;_width: 226px;">
11147 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
11148 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
11149 <div style="height: 70px;">Nonexistant.jpg</div>
11150 <div class="gallerytext">
11151 <p>caption
11152 </p>
11153 </div>
11154 </div></li>
11155 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
11156 <div style="height: 70px;">Nonexistant.jpg</div>
11157 <div class="gallerytext">
11158 </div>
11159 </div></li>
11160 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
11161 <div class="thumb" style="width: 100px;"><div style="margin:31px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/70px-Foobar.jpg" width="70" height="8" /></a></div></div>
11162 <div class="gallerytext">
11163 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11164 </p>
11165 </div>
11166 </div></li>
11167 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
11168 <div class="thumb" style="width: 100px;"><div style="margin:31px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/70px-Foobar.jpg" width="70" height="8" /></a></div></div>
11169 <div class="gallerytext">
11170 </div>
11171 </div></li>
11172 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
11173 <div class="thumb" style="width: 100px;"><div style="margin:31px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="This is a foo-bar." src="http://example.com/images/thumb/3/3a/Foobar.jpg/70px-Foobar.jpg" width="70" height="8" /></a></div></div>
11174 <div class="gallerytext">
11175 <p>Blabla|blabla.
11176 </p>
11177 </div>
11178 </div></li>
11179 </ul>
11180
11181 !! end
11182
11183 !! test
11184 Gallery with wikitext inside caption
11185 !! input
11186 <gallery>
11187 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
11188 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
11189 </gallery>
11190 !! result
11191 <ul class="gallery">
11192 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11193 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="galleryalt" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
11194 <div class="gallerytext">
11195 <p><a href="/wiki/File:Foobar.jpg" class="image" title="desc"><img alt="inneralt" src="http://example.com/images/thumb/3/3a/Foobar.jpg/20px-Foobar.jpg" width="20" height="2" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/30px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/40px-Foobar.jpg 2x" /></a>
11196 </p>
11197 </div>
11198 </div></li>
11199 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11200 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="galleryalt" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
11201 <div class="gallerytext">
11202 <p>This is a test template
11203 </p>
11204 </div>
11205 </div></li>
11206 </ul>
11207
11208 !! end
11209
11210 !! test
11211 gallery (with showfilename option)
11212 !! input
11213 <gallery showfilename>
11214 File:Nonexistant.jpg|caption
11215 File:Nonexistant.jpg
11216 image:foobar.jpg|some '''caption''' [[Main Page]]
11217 File:Foobar.jpg
11218 </gallery>
11219 !! result
11220 <ul class="gallery">
11221 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11222 <div style="height: 150px;">Nonexistant.jpg</div>
11223 <div class="gallerytext">
11224 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
11225 caption
11226 </p>
11227 </div>
11228 </div></li>
11229 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11230 <div style="height: 150px;">Nonexistant.jpg</div>
11231 <div class="gallerytext">
11232 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
11233 </p>
11234 </div>
11235 </div></li>
11236 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11237 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
11238 <div class="gallerytext">
11239 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
11240 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
11241 </p>
11242 </div>
11243 </div></li>
11244 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11245 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
11246 <div class="gallerytext">
11247 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
11248 </p>
11249 </div>
11250 </div></li>
11251 </ul>
11252
11253 !! end
11254
11255 !! test
11256 Gallery (with namespace-less filenames)
11257 !! input
11258 <gallery>
11259 File:Nonexistant.jpg
11260 Nonexistant.jpg
11261 image:foobar.jpg
11262 foobar.jpg
11263 </gallery>
11264 !! result
11265 <ul class="gallery">
11266 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11267 <div style="height: 150px;">Nonexistant.jpg</div>
11268 <div class="gallerytext">
11269 </div>
11270 </div></li>
11271 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11272 <div style="height: 150px;">Nonexistant.jpg</div>
11273 <div class="gallerytext">
11274 </div>
11275 </div></li>
11276 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11277 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
11278 <div class="gallerytext">
11279 </div>
11280 </div></li>
11281 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
11282 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
11283 <div class="gallerytext">
11284 </div>
11285 </div></li>
11286 </ul>
11287
11288 !! end
11289
11290 !! test
11291 HTML Hex character encoding (spells the word "JavaScript")
11292 !! input
11293 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
11294 !! result
11295 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
11296 </p>
11297 !! end
11298
11299 !! test
11300 HTML Hex character encoding bogus encoding (bug 26437 regression check)
11301 !! input
11302 &#xsee;&#XSEE;
11303 !! result
11304 <p>&amp;#xsee;&amp;#XSEE;
11305 </p>
11306 !! end
11307
11308 !! test
11309 HTML Hex character encoding mixed case
11310 !! input
11311 &#xEE;&#Xee;
11312 !! result
11313 <p>&#xee;&#xee;
11314 </p>
11315 !! end
11316
11317 !! test
11318 __FORCETOC__ override
11319 !! input
11320 __NEWSECTIONLINK__
11321 __FORCETOC__
11322 !! result
11323 <p><br />
11324 </p>
11325 !! end
11326
11327 !! test
11328 ISBN code coverage
11329 !! input
11330 ISBN 978-0-1234-56&#x20;789
11331 !! result
11332 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
11333 </p>
11334 !! end
11335
11336 !! test
11337 ISBN followed by 5 spaces
11338 !! input
11339 ISBN
11340 !! result
11341 <p>ISBN
11342 </p>
11343 !! end
11344
11345 !! test
11346 Double ISBN
11347 !! input
11348 ISBN ISBN 1234567890
11349 !! result
11350 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
11351 </p>
11352 !! end
11353
11354 !! test
11355 Bug 22905: <abbr> followed by ISBN followed by </a>
11356 !! input
11357 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
11358 !! result
11359 <p><abbr>(fr)</abbr> <a href="/wiki/Special:BookSources/2753300917" class="internal mw-magiclink-isbn">ISBN 2753300917</a> <a rel="nofollow" class="external text" href="http://www.example.com">example.com</a>
11360 </p>
11361 !! end
11362
11363 !! test
11364 Double RFC
11365 !! input
11366 RFC RFC 1234
11367 !! result
11368 <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
11369 </p>
11370 !! end
11371
11372 !! test
11373 Double RFC with a wiki link
11374 !! input
11375 RFC [[RFC 1234]]
11376 !! result
11377 <p>RFC <a href="/index.php?title=RFC_1234&amp;action=edit&amp;redlink=1" class="new" title="RFC 1234 (page does not exist)">RFC 1234</a>
11378 </p>
11379 !! end
11380
11381 !! test
11382 RFC code coverage
11383 !! input
11384 RFC 983&#x20;987
11385 !! result
11386 <p><a class="external mw-magiclink-rfc" rel="nofollow" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
11387 </p>
11388 !! end
11389
11390 !! test
11391 Centre-aligned image
11392 !! input
11393 [[Image:foobar.jpg|centre]]
11394 !! result
11395 <div class="center"><div class="floatnone"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div></div>
11396
11397 !!end
11398
11399 !! test
11400 None-aligned image
11401 !! input
11402 [[Image:foobar.jpg|none]]
11403 !! result
11404 <div class="floatnone"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
11405
11406 !!end
11407
11408 !! test
11409 Width + Height sized image (using px) (height is ignored)
11410 !! input
11411 [[Image:foobar.jpg|640x480px]]
11412 !! result
11413 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/640px-Foobar.jpg" width="640" height="73" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/960px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/1280px-Foobar.jpg 2x" /></a>
11414 </p>
11415 !!end
11416
11417 !! test
11418 Width-sized image (using px, no following whitespace)
11419 !! input
11420 [[Image:foobar.jpg|640px]]
11421 !! result
11422 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/640px-Foobar.jpg" width="640" height="73" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/960px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/1280px-Foobar.jpg 2x" /></a>
11423 </p>
11424 !!end
11425
11426 !! test
11427 Width-sized image (using px, with following whitespace - test regression from r39467)
11428 !! input
11429 [[Image:foobar.jpg|640px ]]
11430 !! result
11431 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/640px-Foobar.jpg" width="640" height="73" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/960px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/1280px-Foobar.jpg 2x" /></a>
11432 </p>
11433 !!end
11434
11435 !! test
11436 Width-sized image (using px, with preceding whitespace - test regression from r39467)
11437 !! input
11438 [[Image:foobar.jpg| 640px]]
11439 !! result
11440 <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/640px-Foobar.jpg" width="640" height="73" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/960px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/1280px-Foobar.jpg 2x" /></a>
11441 </p>
11442 !!end
11443
11444 !! test
11445 Another italics / bold test
11446 !! input
11447 ''' ''x'
11448 !! result
11449 <pre>'<i> </i>x'
11450 </pre>
11451 !!end
11452
11453 # Note the results may be incorrect, as parserTest output included this:
11454 # XML error: Mismatched tag at byte 6120:
11455 # ...<dd> </dt></dl> </dd...
11456 !! test
11457 dt/dd/dl test
11458 !! options
11459 disabled
11460 !! input
11461 :;;;::
11462 !! result
11463 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd>
11464 </dd></dl>
11465 </dd></dl>
11466 </dt></dl>
11467 </dt></dl>
11468 </dt></dl>
11469 </dd></dl>
11470
11471 !!end
11472
11473
11474 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
11475 !! test
11476 Images with the "|" character in the comment
11477 !! input
11478 [[image:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
11479 !! result
11480 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>An <a rel="nofollow" class="external text" href="http://test/?param1=%7Cleft%7C&amp;param2=%7Cx">external</a> URL</div></div></div>
11481
11482 !!end
11483
11484 !! test
11485 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
11486 !! input
11487 <html><script>alert(1);</script></html>
11488 !! result
11489 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
11490 </p>
11491 !! end
11492
11493 !! test
11494 HTML with raw HTML ($wgRawHtml==true)
11495 !! options
11496 rawhtml
11497 !! input
11498 <html><script>alert(1);</script></html>
11499 !! result
11500 <p><script>alert(1);</script>
11501 </p>
11502 !! end
11503
11504 !! test
11505 Parents of subpages, one level up
11506 !! options
11507 subpage title=[[Subpage test/L1/L2/L3]]
11508 !! input
11509 [[../|L2]]
11510 !! result
11511 <p><a href="/index.php?title=Subpage_test/L1/L2&amp;action=edit&amp;redlink=1" class="new" title="Subpage test/L1/L2 (page does not exist)">L2</a>
11512 </p>
11513 !! end
11514
11515
11516 !! test
11517 Parents of subpages, one level up, not named
11518 !! options
11519 subpage title=[[Subpage test/L1/L2/L3]]
11520 !! input
11521 [[../]]
11522 !! result
11523 <p><a href="/index.php?title=Subpage_test/L1/L2&amp;action=edit&amp;redlink=1" class="new" title="Subpage test/L1/L2 (page does not exist)">Subpage test/L1/L2</a>
11524 </p>
11525 !! end
11526
11527
11528
11529 !! test
11530 Parents of subpages, two levels up
11531 !! options
11532 subpage title=[[Subpage test/L1/L2/L3]]
11533 !! input
11534 [[../../|L1]]2
11535
11536 [[../../|L1]]l
11537 !! result
11538 <p><a href="/index.php?title=Subpage_test/L1&amp;action=edit&amp;redlink=1" class="new" title="Subpage test/L1 (page does not exist)">L1</a>2
11539 </p><p><a href="/index.php?title=Subpage_test/L1&amp;action=edit&amp;redlink=1" class="new" title="Subpage test/L1 (page does not exist)">L1l</a>
11540 </p>
11541 !! end
11542
11543 !! test
11544 Parents of subpages, two levels up, without trailing slash or name.
11545 !! options
11546 subpage title=[[Subpage test/L1/L2/L3]]
11547 !! input
11548 [[../..]]
11549 !! result
11550 <p>[[../..]]
11551 </p>
11552 !! end
11553
11554 !! test
11555 Parents of subpages, two levels up, with lots of extra trailing slashes.
11556 !! options
11557 subpage title=[[Subpage test/L1/L2/L3]]
11558 !! input
11559 [[../../////]]
11560 !! result
11561 <p><a href="/index.php?title=Subpage_test/L1////&amp;action=edit&amp;redlink=1" class="new" title="Subpage test/L1//// (page does not exist)">///</a>
11562 </p>
11563 !! end
11564
11565 !! test
11566 Definition list code coverage
11567 !! input
11568 ; title : def
11569 ; title : def
11570 ;title: def
11571 !! result
11572 <dl><dt> title &#160;</dt><dd> def
11573 </dd><dt> title&#160;</dt><dd> def
11574 </dd><dt>title</dt><dd> def
11575 </dd></dl>
11576
11577 !! end
11578
11579 !! test
11580 Don't fall for the self-closing div
11581 !! input
11582 <div>hello world</div/>
11583 !! result
11584 <div>hello world</div>
11585
11586 !! end
11587
11588 !! test
11589 MSGNW magic word
11590 !! input
11591 {{MSGNW:msg}}
11592 !! result
11593 <p>&#91;&#91;:Template:Msg&#93;&#93;
11594 </p>
11595 !! end
11596
11597 !! test
11598 RAW magic word
11599 !! input
11600 {{RAW:QUERTY}}
11601 !! result
11602 <p><a href="/index.php?title=Template:QUERTY&amp;action=edit&amp;redlink=1" class="new" title="Template:QUERTY (page does not exist)">Template:QUERTY</a>
11603 </p>
11604 !! end
11605
11606 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
11607 !! test
11608 Always escape literal '>' in output, not just after '<'
11609 !! input
11610 ><>
11611 !! result
11612 <p>&gt;&lt;&gt;
11613 </p>
11614 !! end
11615
11616 !! test
11617 Template caching
11618 !! input
11619 {{Test}}
11620 {{Test}}
11621 !! result
11622 <p>This is a test template
11623 This is a test template
11624 </p>
11625 !! end
11626
11627
11628 !! article
11629 MediaWiki:Fake
11630 !! text
11631 ==header==
11632 !! endarticle
11633
11634 !! test
11635 Inclusion of !userCanEdit() content
11636 !! input
11637 {{MediaWiki:Fake}}
11638 !! result
11639 <h2><span class="mw-headline" id="header">header</span> <span class="mw-editsection">[<a href="/index.php?title=MediaWiki:Fake&amp;action=edit&amp;section=T-1" title="MediaWiki:Fake">edit</a>]</span></h2>
11640
11641 !! end
11642
11643
11644 !! test
11645 Out-of-order TOC heading levels
11646 !! input
11647 ==2==
11648 ======6======
11649 ===3===
11650 =1=
11651 =====5=====
11652 ==2==
11653 !! result
11654 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
11655 <ul>
11656 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
11657 <ul>
11658 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
11659 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
11660 </ul>
11661 </li>
11662 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
11663 <ul>
11664 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
11665 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
11666 </ul>
11667 </li>
11668 </ul>
11669 </td></tr></table>
11670 <h2><span class="mw-headline" id="2">2</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: 2">edit</a>]</span></h2>
11671 <h6><span class="mw-headline" id="6">6</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: 6">edit</a>]</span></h6>
11672 <h3><span class="mw-headline" id="3">3</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: 3">edit</a>]</span></h3>
11673 <h1><span class="mw-headline" id="1">1</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: 1">edit</a>]</span></h1>
11674 <h5><span class="mw-headline" id="5">5</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: 5">edit</a>]</span></h5>
11675 <h2><span class="mw-headline" id="2_2">2</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: 2">edit</a>]</span></h2>
11676
11677 !! end
11678
11679
11680 !! test
11681 ISBN with a dummy number
11682 !! input
11683 ISBN ---
11684 !! result
11685 <p>ISBN ---
11686 </p>
11687 !! end
11688
11689
11690 !! test
11691 ISBN with space-delimited number
11692 !! input
11693 ISBN 92 9017 032 8
11694 !! result
11695 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
11696 </p>
11697 !! end
11698
11699
11700 !! test
11701 ISBN with multiple spaces, no number
11702 !! input
11703 ISBN foo
11704 !! result
11705 <p>ISBN foo
11706 </p>
11707 !! end
11708
11709
11710 !! test
11711 ISBN length
11712 !! input
11713 ISBN 123456789
11714
11715 ISBN 1234567890
11716
11717 ISBN 12345678901
11718 !! result
11719 <p>ISBN 123456789
11720 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
11721 </p><p>ISBN 12345678901
11722 </p>
11723 !! end
11724
11725
11726 !! test
11727 ISBN with trailing year (bug 8110)
11728 !! input
11729 ISBN 1-234-56789-0 - 2006
11730
11731 ISBN 1 234 56789 0 - 2006
11732 !! result
11733 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
11734 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
11735 </p>
11736 !! end
11737
11738
11739 !! test
11740 anchorencode
11741 !! input
11742 {{anchorencode:foo bar©#%n}}
11743 !! result
11744 <p>foo_bar.C2.A9.23.25n
11745 </p>
11746 !! end
11747
11748 !! test
11749 anchorencode trims spaces
11750 !! input
11751 {{anchorencode: __pretty__please__}}
11752 !! result
11753 <p>pretty_please
11754 </p>
11755 !! end
11756
11757 !! test
11758 anchorencode deals with links
11759 !! input
11760 {{anchorencode: [[hello|world]] [[hi]]}}
11761 !! result
11762 <p>world_hi
11763 </p>
11764 !! end
11765
11766 !! test
11767 anchorencode deals with templates
11768 !! input
11769 {{anchorencode: {{Foo}} }}
11770 !! result
11771 <p>FOO
11772 </p>
11773 !! end
11774
11775 !! test
11776 anchorencode encodes like the TOC generator: (bug 18431)
11777 !! input
11778 === _ +:.3A%3A&&amp;]] ===
11779 {{anchorencode: _ +:.3A%3A&&amp;]] }}
11780 __NOEDITSECTION__
11781 !! result
11782 <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span> </h3>
11783 <p>.2B:.3A.253A.26.26.5D.5D
11784 </p>
11785 !! end
11786
11787 # Expected output in the following test is not necessarily expected (there
11788 # should probably be <p> tags inside the <blockquote> in the output) -- it's
11789 # only testing for well-formedness.
11790 !! test
11791 Bug 6200: blockquotes and paragraph formatting
11792 !! input
11793 <blockquote>
11794 foo
11795 </blockquote>
11796
11797 bar
11798
11799 baz
11800 !! result
11801 <blockquote>
11802 foo
11803 </blockquote>
11804 <p>bar
11805 </p>
11806 <pre>baz
11807 </pre>
11808 !! end
11809
11810 !! test
11811 Bug 8293: Use of center tag ruins paragraph formatting
11812 !! input
11813 <center>
11814 foo
11815 </center>
11816
11817 bar
11818
11819 baz
11820 !! result
11821 <center>
11822 <p>foo
11823 </p>
11824 </center>
11825 <p>bar
11826 </p>
11827 <pre>baz
11828 </pre>
11829 !! end
11830
11831 !!test
11832 Parsing of overlapping (improperly nested) inline html tags (PHP parser)
11833 !!options
11834 php
11835 !!input
11836 <span><s>x</span></s>
11837 !!result
11838 <p><span><s>x&lt;/span&gt;</s></span>
11839 </p>
11840 !!end
11841
11842 !!test
11843 Parsing of overlapping (improperly nested) inline html tags (Parsoid)
11844 !!options
11845 parsoid
11846 !!input
11847 <span><s>x</span></s>
11848 !!result
11849 <p><span><s>x</s></span><s></s>
11850 </p>
11851 !!end
11852
11853 ###
11854 ### Language variants related tests
11855 ###
11856 !! test
11857 Self-link in language variants
11858 !! options
11859 title=[[Dunav]] language=sr
11860 !! input
11861 Both [[Dunav]] and [[Дунав]] are names for this river.
11862 !! result
11863 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
11864 </p>
11865 !!end
11866
11867 !! article
11868 Дуна
11869 !! text
11870 content
11871 !! endarticle
11872
11873 !! test
11874 Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
11875 !! options
11876 title=[[Duna]] language=sr
11877 !! input
11878 [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
11879 !! result
11880 <p><a href="/wiki/%D0%94%D1%83%D0%BD%D0%B0" title="Дуна">Дуна</a> is not a self-link while <strong class="selflink">Duna</strong> and <strong class="selflink">Dуна</strong> are still self-links.
11881 </p>
11882 !! end
11883
11884 !! test
11885 Link to pages in language variants
11886 !! options
11887 language=sr
11888 !! input
11889 Main Page can be written as [[Маин Паге]]
11890 !! result
11891 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
11892 </p>
11893 !!end
11894
11895
11896 !! test
11897 Multiple links to pages in language variants
11898 !! options
11899 language=sr
11900 !! input
11901 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
11902 !! result
11903 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a> can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a> same as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>.
11904 </p>
11905 !!end
11906
11907
11908 !! test
11909 Simple template in language variants
11910 !! options
11911 language=sr
11912 !! input
11913 {{тест}}
11914 !! result
11915 <p>This is a test template
11916 </p>
11917 !! end
11918
11919
11920 !! test
11921 Template with explicit namespace in language variants
11922 !! options
11923 language=sr
11924 !! input
11925 {{Template:тест}}
11926 !! result
11927 <p>This is a test template
11928 </p>
11929 !! end
11930
11931
11932 !! test
11933 Basic test for template parameter in language variants
11934 !! options
11935 language=sr
11936 !! input
11937 {{парамтест|param=foo}}
11938 !! result
11939 <p>This is a test template with parameter foo
11940 </p>
11941 !! end
11942
11943
11944 !! test
11945 Simple category in language variants
11946 !! options
11947 language=sr cat
11948 !! input
11949 [[Category:МедиаWики Усер'с Гуиде]]
11950 !! result
11951 <a href="/wiki/%D0%9A%D0%B0%D1%82%D0%B5%D0%B3%D0%BE%D1%80%D0%B8%D1%98%D0%B0:MediaWiki_User%27s_Guide" title="Категорија:MediaWiki User's Guide">MediaWiki User's Guide</a>
11952 !! end
11953
11954
11955 !! article
11956 Category:分类
11957 !! text
11958 blah
11959 !! endarticle
11960
11961 !! article
11962 Category:分類
11963 !! text
11964 blah
11965 !! endarticle
11966
11967 !! test
11968 Don't convert blue categorylinks to another variant (bug 33210)
11969 !! options
11970 language=zh cat
11971 !! input
11972 [[A]][[Category:分类]]
11973 !! result
11974 <a href="/wiki/Category:%E5%88%86%E7%B1%BB" title="Category:分类">分类</a>
11975 !! end
11976
11977
11978 !! test
11979 Stripping -{}- tags (language variants)
11980 !! options
11981 language=sr
11982 !! input
11983 Latin proverb: -{Ne nuntium necare}-
11984 !! result
11985 <p>Latin proverb: Ne nuntium necare
11986 </p>
11987 !! end
11988
11989
11990 !! test
11991 Prevent conversion with -{}- tags (language variants)
11992 !! options
11993 language=sr variant=sr-ec
11994 !! input
11995 Latinski: -{Ne nuntium necare}-
11996 !! result
11997 <p>Латински: Ne nuntium necare
11998 </p>
11999 !! end
12000
12001
12002 !! test
12003 Prevent conversion of text with -{}- tags (language variants)
12004 !! options
12005 language=sr variant=sr-ec
12006 !! input
12007 Latinski: -{Ne nuntium necare}-
12008 !! result
12009 <p>Латински: Ne nuntium necare
12010 </p>
12011 !! end
12012
12013
12014 !! test
12015 Prevent conversion of links with -{}- tags (language variants)
12016 !! options
12017 language=sr variant=sr-ec
12018 !! input
12019 -{[[Main Page]]}-
12020 !! result
12021 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
12022 </p>
12023 !! end
12024
12025
12026 !! test
12027 -{}- tags within headlines (within html for parserConvert())
12028 !! options
12029 language=sr variant=sr-ec
12030 !! input
12031 == -{Naslov}- ==
12032 !! result
12033 <h2><span class="mw-headline" id="-.7BNaslov.7D-">Naslov</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Уредите одељак „Naslov“">уреди</a>]</span></h2>
12034
12035 !! end
12036
12037
12038 !! test
12039 Explicit definition of language variant alternatives
12040 !! options
12041 language=zh variant=zh-tw
12042 !! input
12043 -{zh:China;zh-tw:Taiwan}-, not China
12044 !! result
12045 <p>Taiwan, not China
12046 </p>
12047 !! end
12048
12049
12050 !! test
12051 Conversion around HTML tags
12052 !! options
12053 language=sr variant=sr-ec
12054 !! input
12055 -{H|span=>sr-ec:script;title=>sr-ec:src;}-
12056 <span title="La-{sr-el:L;sr-ec:C;}-tin">ski</span>
12057 !! result
12058 <p>
12059 <span title="ЛаCтин">ски</span>
12060 </p>
12061 !! end
12062
12063
12064 !! test
12065 Explicit session-wise language variant mapping (A flag and - flag)
12066 !! options
12067 language=zh variant=zh-tw
12068 !! input
12069 Taiwan is not China.
12070 But -{A|zh:China;zh-tw:Taiwan}- is China,
12071 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
12072 and -{China}- is China.
12073 !! result
12074 <p>Taiwan is not China.
12075 But Taiwan is Taiwan,
12076 (This should be stripped!)
12077 and China is China.
12078 </p>
12079 !! end
12080
12081 !! test
12082 Explicit session-wise language variant mapping (H flag for hide)
12083 !! options
12084 language=zh variant=zh-tw
12085 !! input
12086 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
12087 Taiwan is China.
12088 !! result
12089 <p>(This should be stripped!)
12090 Taiwan is Taiwan.
12091 </p>
12092 !! end
12093
12094 !! test
12095 Adding explicit conversion rule for title (T flag)
12096 !! options
12097 language=zh variant=zh-tw showtitle
12098 !! input
12099 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
12100 !! result
12101 Taiwan
12102 <p>Should be stripped!
12103 </p>
12104 !! end
12105
12106 !! test
12107 Testing that changing the language variant here in the tests actually works
12108 !! options
12109 language=zh variant=zh showtitle
12110 !! input
12111 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
12112 !! result
12113 China
12114 <p>Should be stripped!
12115 </p>
12116 !! end
12117
12118 !! test
12119 Recursive conversion of alt and title attrs shouldn't clear converter state
12120 !! options
12121 language=zh variant=zh-cn showtitle
12122 !! input
12123 -{H|zh-cn:Exclamation;zh-tw:exclamation;}-
12124 Should be stripped-{T|zh-cn:China;zh-tw:Taiwan}-<span title="exclamation">!</span>
12125 !! result
12126 China
12127 <p>
12128 Should be stripped<span title="Exclamation">!</span>
12129 </p>
12130 !! end
12131
12132 !! test
12133 Bug 24072: more test on conversion rule for title
12134 !! options
12135 language=zh variant=zh-tw showtitle
12136 !! input
12137 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
12138 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
12139 !! result
12140 Taiwan
12141 <p>This should be stripped!
12142 This won't take interferes with the title rule.
12143 </p>
12144 !! end
12145
12146 !! test
12147 Partly disable title conversion if variant == main language code
12148 !! options
12149 language=zh variant=zh title=[[ZH]] showtitle
12150 !! input
12151 -{T|zh-cn:CN;zh-tw:TW}-
12152 !! result
12153 ZH
12154 <p>
12155 </p>
12156 !! end
12157
12158 !! test
12159 Partly disable title conversion if variant == main language code, more
12160 !! options
12161 language=zh variant=zh title=[[ZH]] showtitle
12162 !! input
12163 -{T|TW}-
12164 !! result
12165 ZH
12166 <p>
12167 </p>
12168 !! end
12169
12170 !! test
12171 Raw output of variant escape tags (R flag)
12172 !! options
12173 language=zh variant=zh-tw
12174 !! input
12175 Raw: -{R|zh:China;zh-tw:Taiwan}-
12176 !! result
12177 <p>Raw: zh:China;zh-tw:Taiwan
12178 </p>
12179 !! end
12180
12181 !! test
12182 Nested using of manual convert syntax
12183 !! options
12184 language=zh variant=zh-hk
12185 !! input
12186 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
12187 !! result
12188 <p>Nested: Hello Hong Kong!
12189 </p>
12190 !! end
12191
12192 !! test
12193 Proper conversion of text in external links
12194 !! options
12195 language=sr variant=sr-ec
12196 !! input
12197 http://www.google.com
12198 gopher://www.google.com
12199 [http://www.google.com http://www.google.com]
12200 [gopher://www.google.com gopher://www.google.com]
12201 [https://www.google.com irc://www.google.com]
12202 [ftp://www.google.com www.google.com/ftp://dir]
12203 [//www.google.com www.google.com]
12204 !! result
12205 <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
12206 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
12207 <a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
12208 <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
12209 <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
12210 <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
12211 <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
12212 </p>
12213 !! end
12214
12215 !! test
12216 Do not convert roman numbers to language variants
12217 !! options
12218 language=sr variant=sr-ec
12219 !! input
12220 Fridrih IV je car.
12221 !! result
12222 <p>Фридрих IV је цар.
12223 </p>
12224 !! end
12225
12226 !! test
12227 Unclosed language converter markup "-{"
12228 !! options
12229 language=sr
12230 !! input
12231 -{T|hello
12232 !! result
12233 <p>-{T|hello
12234 </p>
12235 !! end
12236
12237 !! test
12238 Don't convert raw rule "-{R|=&gt;}-" to "=>"
12239 !! options
12240 language=sr
12241 !! input
12242 -{R|=&gt;}-
12243 !! result
12244 <p>=&gt;
12245 </p>
12246 !!end
12247
12248 !!article
12249 Template:Bullet
12250 !!text
12251 * Bar
12252 !!endarticle
12253
12254 !! test
12255 Bug 529: Uncovered bullet
12256 !! input
12257 * Foo {{bullet}}
12258 !! result
12259 <ul><li> Foo
12260 </li><li> Bar
12261 </li></ul>
12262
12263 !! end
12264
12265 # Plain MediaWiki does not remove empty lists, but tidy actually does.
12266 # Templates in Wikipedia rely on this behavior, as tidy has always been
12267 # enabled there. These tests are normally run *without* tidy, so specify the
12268 # full output here.
12269 # To test realistic parsing behavior, apply a tidy-like transformation to both
12270 # the expected output and your parser's output.
12271 !! test
12272 Bug 529: Uncovered bullet leaving empty list, normally removed by tidy
12273 !! input
12274 ******* Foo {{bullet}}
12275 !! result
12276 <ul><li><ul><li><ul><li><ul><li><ul><li><ul><li><ul><li> Foo
12277 </li></ul>
12278 </li></ul>
12279 </li></ul>
12280 </li></ul>
12281 </li></ul>
12282 </li></ul>
12283 </li><li> Bar
12284 </li></ul>
12285
12286 !! end
12287
12288 !! test
12289 Bug 529: Uncovered table already at line-start
12290 !! input
12291 x
12292
12293 {{table}}
12294 y
12295 !! result
12296 <p>x
12297 </p>
12298 <table>
12299 <tr>
12300 <td> 1 </td>
12301 <td> 2
12302 </td></tr>
12303 <tr>
12304 <td> 3 </td>
12305 <td> 4
12306 </td></tr></table>
12307 <p>y
12308 </p>
12309 !! end
12310
12311 !! test
12312 Bug 529: Uncovered bullet in parser function result
12313 !! input
12314 * Foo {{lc:{{bullet}} }}
12315 !! result
12316 <ul><li> Foo
12317 </li><li> bar
12318 </li></ul>
12319
12320 !! end
12321
12322 !! test
12323 Bug 5678: Double-parsed template argument
12324 !! input
12325 {{lc:{{{1}}}|hello}}
12326 !! result
12327 <p>{{{1}}}
12328 </p>
12329 !! end
12330
12331 !! test
12332 Bug 5678: Double-parsed template invocation
12333 !! input
12334 {{lc:{{paramtest {{!}} param = hello }} }}
12335 !! result
12336 <p>{{paramtest | param = hello }}
12337 </p>
12338 !! end
12339
12340 !! test
12341 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
12342 !! options
12343 language=cs
12344 title=[[Main Page]]
12345 !! input
12346 {{PRVNÍVELKÉ:ěščř}}
12347 {{prvnívelké:ěščř}}
12348 {{PRVNÍMALÉ:ěščř}}
12349 {{prvnímalé:ěščř}}
12350 {{MALÁ:ěščř}}
12351 {{malá:ěščř}}
12352 {{VELKÁ:ěščř}}
12353 {{velká:ěščř}}
12354 !! result
12355 <p>Ěščř
12356 Ěščř
12357 ěščř
12358 ěščř
12359 ěščř
12360 ěščř
12361 ĚŠČŘ
12362 ĚŠČŘ
12363 </p>
12364 !! end
12365
12366 !! test
12367 Morwen/13: Unclosed link followed by heading
12368 !! input
12369 [[link
12370 ==heading==
12371 !! result
12372 <p>[[link
12373 </p>
12374 <h2><span class="mw-headline" id="heading">heading</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: heading">edit</a>]</span></h2>
12375
12376 !! end
12377
12378 !! test
12379 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
12380 !! input
12381 {{foo|
12382 =heading=
12383 !! result
12384 <p>{{foo|
12385 </p>
12386 <h1><span class="mw-headline" id="heading">heading</span> </h1>
12387
12388 !! end
12389
12390 !! test
12391 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
12392 !! input
12393 {{foo|
12394 ==heading==
12395 !! result
12396 <p>{{foo|
12397 </p>
12398 <h2><span class="mw-headline" id="heading">heading</span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: heading">edit</a>]</span></h2>
12399
12400 !! end
12401
12402 !! test
12403 Tildes in comments
12404 !! options
12405 pst
12406 !! input
12407 <!-- ~~~~ -->
12408 !! result
12409 <!-- ~~~~ -->
12410 !! end
12411
12412 !! test
12413 Paragraphs inside divs (no extra line breaks)
12414 !! input
12415 <div>Line one
12416
12417 Line two</div>
12418 !! result
12419 <div>Line one
12420 Line two</div>
12421
12422 !! end
12423
12424 !! test
12425 Paragraphs inside divs (extra line break on open)
12426 !! input
12427 <div>
12428 Line one
12429
12430 Line two</div>
12431 !! result
12432 <div>
12433 <p>Line one
12434 </p>
12435 Line two</div>
12436
12437 !! end
12438
12439 !! test
12440 Paragraphs inside divs (extra line break on close)
12441 !! input
12442 <div>Line one
12443
12444 Line two
12445 </div>
12446 !! result
12447 <div>Line one
12448 <p>Line two
12449 </p>
12450 </div>
12451
12452 !! end
12453
12454 !! test
12455 Paragraphs inside divs (extra line break on open and close)
12456 !! input
12457 <div>
12458 Line one
12459
12460 Line two
12461 </div>
12462 !! result
12463 <div>
12464 <p>Line one
12465 </p><p>Line two
12466 </p>
12467 </div>
12468
12469 !! end
12470
12471 !! test
12472 Nesting tags, paragraphs on lines which begin with <div>
12473 !! options
12474 disabled
12475 !! input
12476 <div></div><strong>A
12477 B</strong>
12478 !! result
12479 <div></div>
12480 <p><strong>A
12481 B</strong>
12482 </p>
12483 !! end
12484
12485 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
12486 !! test
12487 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
12488 !! options
12489 disabled
12490 !! input
12491 <blockquote>Line one
12492
12493 Line two</blockquote>
12494 !! result
12495 <blockquote>Line one
12496 Line two</blockquote>
12497
12498 !! end
12499
12500 !! test
12501 Bug 6200: paragraphs inside blockquotes (extra line break on open)
12502 !! options
12503 disabled
12504 !! input
12505 <blockquote>
12506 Line one
12507
12508 Line two</blockquote>
12509 !! result
12510 <blockquote>
12511 <p>Line one
12512 </p>
12513 Line two</blockquote>
12514
12515 !! end
12516
12517 !! test
12518 Bug 6200: paragraphs inside blockquotes (extra line break on close)
12519 !! options
12520 disabled
12521 !! input
12522 <blockquote>Line one
12523
12524 Line two
12525 </blockquote>
12526 !! result
12527 <blockquote>Line one
12528 <p>Line two
12529 </p>
12530 </blockquote>
12531
12532 !! end
12533
12534 !! test
12535 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
12536 !! options
12537 disabled
12538 !! input
12539 <blockquote>
12540 Line one
12541
12542 Line two
12543 </blockquote>
12544 !! result
12545 <blockquote>
12546 <p>Line one
12547 </p><p>Line two
12548 </p>
12549 </blockquote>
12550
12551 !! end
12552
12553 !! test
12554 Paragraphs inside blockquotes/divs (no extra line breaks)
12555 !! input
12556 <blockquote><div>Line one
12557
12558 Line two</div></blockquote>
12559 !! result
12560 <blockquote><div>Line one
12561 Line two</div></blockquote>
12562
12563 !! end
12564
12565 !! test
12566 Paragraphs inside blockquotes/divs (extra line break on open)
12567 !! input
12568 <blockquote><div>
12569 Line one
12570
12571 Line two</div></blockquote>
12572 !! result
12573 <blockquote><div>
12574 <p>Line one
12575 </p>
12576 Line two</div></blockquote>
12577
12578 !! end
12579
12580 !! test
12581 Paragraphs inside blockquotes/divs (extra line break on close)
12582 !! input
12583 <blockquote><div>Line one
12584
12585 Line two
12586 </div></blockquote>
12587 !! result
12588 <blockquote><div>Line one
12589 <p>Line two
12590 </p>
12591 </div></blockquote>
12592
12593 !! end
12594
12595 !! test
12596 Paragraphs inside blockquotes/divs (extra line break on open and close)
12597 !! input
12598 <blockquote><div>
12599 Line one
12600
12601 Line two
12602 </div></blockquote>
12603 !! result
12604 <blockquote><div>
12605 <p>Line one
12606 </p><p>Line two
12607 </p>
12608 </div></blockquote>
12609
12610 !! end
12611
12612 !! test
12613 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
12614 !! options
12615 wgLinkHolderBatchSize=0
12616 !! input
12617 [[meatball:1]]
12618 [[meatball:2]]
12619 [[meatball:3]]
12620 !! result
12621 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
12622 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
12623 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
12624 </p>
12625 !! end
12626
12627 !! test
12628 Free external link invading image caption
12629 !! input
12630 [[Image:Foobar.jpg|thumb|http://x|hello]]
12631 !! result
12632 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>hello</div></div></div>
12633
12634 !! end
12635
12636 !! test
12637 Bug 15196: localised external link numbers
12638 !! options
12639 language=fa
12640 !! input
12641 [http://en.wikipedia.org/]
12642 !! result
12643 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
12644 </p>
12645 !! end
12646
12647 !! test
12648 Multibyte character in padleft
12649 !! input
12650 {{padleft:-Hello|7|Æ}}
12651 !! result
12652 <p>Æ-Hello
12653 </p>
12654 !! end
12655
12656 !! test
12657 Multibyte character in padright
12658 !! input
12659 {{padright:Hello-|7|Æ}}
12660 !! result
12661 <p>Hello-Æ
12662 </p>
12663 !! end
12664
12665 !!test
12666 formatdate parser function
12667 !!input
12668 {{#formatdate:2009-03-24}}
12669 !! result
12670 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
12671 </p>
12672 !! end
12673
12674 !!test
12675 formatdate parser function, with default format
12676 !!input
12677 {{#formatdate:2009-03-24|mdy}}
12678 !! result
12679 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
12680 </p>
12681 !! end
12682
12683 !! test
12684 Spacing of numbers in formatted dates
12685 !! input
12686 {{#formatdate:January 15}}
12687 !! result
12688 <p><span class="mw-formatted-date" title="01-15">January 15</span>
12689 </p>
12690 !! end
12691
12692 !! test
12693 formatdate parser function, with default format and on a page of which the content language is always English and different from the wiki content language
12694 !! options
12695 language=nl title=[[MediaWiki:Common.css]]
12696 !! input
12697 {{#formatdate:2009-03-24|dmy}}
12698 !! result
12699 <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
12700 </p>
12701 !! end
12702
12703 #
12704 #
12705 #
12706
12707 #
12708 # Edit comments
12709 #
12710
12711 !! test
12712 Edit comment with link
12713 !! options
12714 comment
12715 !! input
12716 I like the [[Main Page]] a lot
12717 !! result
12718 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
12719 !!end
12720
12721 !! test
12722 Edit comment with link and link text
12723 !! options
12724 comment
12725 !! input
12726 I like the [[Main Page|best pages]] a lot
12727 !! result
12728 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
12729 !!end
12730
12731 !! test
12732 Edit comment with link and link text with suffix
12733 !! options
12734 comment
12735 !! input
12736 I like the [[Main Page|best page]]s a lot
12737 !! result
12738 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
12739 !!end
12740
12741 !! test
12742 Edit comment with section link (non-local, eg in history list)
12743 !! options
12744 comment title=[[Main Page]]
12745 !! input
12746 /* External links */ removed bogus entries
12747 !! result
12748 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
12749 !!end
12750
12751 !! test
12752 Edit comment with section link and text before it (non-local, eg in history list)
12753 !! options
12754 comment title=[[Main Page]]
12755 !! input
12756 pre-comment text /* External links */ removed bogus entries
12757 !! result
12758 pre-comment text - <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
12759 !!end
12760
12761 !! test
12762 Edit comment with section link (local, eg in diff view)
12763 !! options
12764 comment local title=[[Main Page]]
12765 !! input
12766 /* External links */ removed bogus entries
12767 !! result
12768 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
12769 !!end
12770
12771 !! test
12772 Edit comment with subpage link (bug 14080)
12773 !! options
12774 comment
12775 subpage
12776 title=[[Subpage test]]
12777 !! input
12778 Poked at a [[/subpage]] here...
12779 !! result
12780 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
12781 !!end
12782
12783 !! test
12784 Edit comment with subpage link and link text (bug 14080)
12785 !! options
12786 comment
12787 subpage
12788 title=[[Subpage test]]
12789 !! input
12790 Poked at a [[/subpage|neat little page]] here...
12791 !! result
12792 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
12793 !!end
12794
12795 !! test
12796 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
12797 !! options
12798 comment
12799 title=[[Subpage test]]
12800 !! input
12801 Poked at a [[/subpage]] here...
12802 !! result
12803 Poked at a <a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a> here...
12804 !!end
12805
12806 !! test
12807 Edit comment with bare anchor link (local, as on diff)
12808 !! options
12809 comment
12810 local
12811 title=[[Main Page]]
12812 !!input
12813 [[#section]]
12814 !! result
12815 <a href="#section">#section</a>
12816 !! end
12817
12818 !! test
12819 Edit comment with bare anchor link (non-local, as on history)
12820 !! options
12821 comment
12822 title=[[Main Page]]
12823 !!input
12824 [[#section]]
12825 !! result
12826 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
12827 !! end
12828
12829 !! test
12830 Anchor starting with underscore
12831 !!input
12832 [[#_ref|One]]
12833 !! result
12834 <p><a href="#_ref">One</a>
12835 </p>
12836 !! end
12837
12838 !! test
12839 Id starting with underscore
12840 !!input
12841 <div id="_ref"></div>
12842 !! result
12843 <div id="_ref"></div>
12844
12845 !! end
12846
12847 !! test
12848 Space normalisation on autocomment (bug 22784)
12849 !! options
12850 comment
12851 title=[[Main Page]]
12852 !!input
12853 /* __hello__world__ */
12854 !! result
12855 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
12856 !! end
12857
12858 !! test
12859 percent-encoding and + signs in comments (Bug 26410)
12860 !! options
12861 comment
12862 !!input
12863 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
12864 !! result
12865 <a href="/index.php?title=ABC3D%25_%2B%2B&amp;action=edit&amp;redlink=1" class="new" title="ABC3D% ++ (page does not exist)">ABC3D% ++</a> <a href="/index.php?title=ABC3D%25_%2B%2B&amp;action=edit&amp;redlink=1" class="new" title="ABC3D% ++ (page does not exist)">+%20</a>
12866 !! end
12867
12868 !! test
12869 Bad images - basic functionality
12870 !! options
12871 disabled
12872 !! input
12873 [[File:Bad.jpg]]
12874 !! result
12875 !! end
12876
12877 !! test
12878 Bad images - bug 16039: text after bad image disappears
12879 !! options
12880 disabled
12881 !! input
12882 Foo bar
12883 [[File:Bad.jpg]]
12884 Bar foo
12885 !! result
12886 <p>Foo bar
12887 </p><p>Bar foo
12888 </p>
12889 !! end
12890
12891 !! test
12892 Verify that displaytitle works (bug #22501) no displaytitle
12893 !! options
12894 showtitle
12895 !! config
12896 wgAllowDisplayTitle=true
12897 wgRestrictDisplayTitle=false
12898 !! input
12899 this is not the the title
12900 !! result
12901 Parser test
12902 <p>this is not the the title
12903 </p>
12904 !! end
12905
12906 !! test
12907 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
12908 !! options
12909 showtitle
12910 title=[[Screen]]
12911 !! config
12912 wgAllowDisplayTitle=true
12913 wgRestrictDisplayTitle=false
12914 !! input
12915 this is not the the title
12916 {{DISPLAYTITLE:whatever}}
12917 !! result
12918 whatever
12919 <p>this is not the the title
12920 </p>
12921 !! end
12922
12923 !! test
12924 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
12925 !! options
12926 showtitle
12927 title=[[Screen]]
12928 !! config
12929 wgAllowDisplayTitle=true
12930 wgRestrictDisplayTitle=true
12931 !! input
12932 this is not the the title
12933 {{DISPLAYTITLE:whatever}}
12934 !! result
12935 Screen
12936 <p>this is not the the title
12937 </p>
12938 !! end
12939
12940 !! test
12941 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
12942 !! options
12943 showtitle
12944 title=[[Screen]]
12945 !! config
12946 wgAllowDisplayTitle=true
12947 wgRestrictDisplayTitle=true
12948 !! input
12949 this is not the the title
12950 {{DISPLAYTITLE:screen}}
12951 !! result
12952 screen
12953 <p>this is not the the title
12954 </p>
12955 !! end
12956
12957 !! test
12958 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
12959 !! options
12960 showtitle
12961 title=[[Screen]]
12962 !! config
12963 wgAllowDisplayTitle=false
12964 !! input
12965 this is not the the title
12966 {{DISPLAYTITLE:screen}}
12967 !! result
12968 Screen
12969 <p>this is not the the title
12970 <a href="/index.php?title=Template:DISPLAYTITLE:screen&amp;action=edit&amp;redlink=1" class="new" title="Template:DISPLAYTITLE:screen (page does not exist)">Template:DISPLAYTITLE:screen</a>
12971 </p>
12972 !! end
12973
12974 !! test
12975 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
12976 !! options
12977 showtitle
12978 title=[[Screen]]
12979 !! config
12980 wgAllowDisplayTitle=false
12981 !! input
12982 this is not the the title
12983 !! result
12984 Screen
12985 <p>this is not the the title
12986 </p>
12987 !! end
12988
12989 !! test
12990 preload: check <noinclude> and <includeonly>
12991 !! options
12992 preload
12993 !! input
12994 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
12995 !! result
12996 Hello kind world.
12997 !! end
12998
12999 !! test
13000 preload: check <onlyinclude>
13001 !! options
13002 preload
13003 !! input
13004 Goodbye <onlyinclude>Hello world</onlyinclude>
13005 !! result
13006 Hello world
13007 !! end
13008
13009 !! test
13010 preload: can pass tags through if we want to
13011 !! options
13012 preload
13013 !! input
13014 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
13015 !! result
13016 <includeonly>Hello world</includeonly>
13017 !! end
13018
13019 !! test
13020 preload: check that it doesn't try to do tricks
13021 !! options
13022 preload
13023 !! input
13024 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
13025 !! result
13026 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
13027 !! end
13028
13029 !! test
13030 Play a bit with r67090 and bug 3158
13031 !! options
13032 disabled
13033 !! input
13034 <div style="width:50% !important">&nbsp;</div>
13035 <div style="width:50%&nbsp;!important">&nbsp;</div>
13036 <div style="width:50%&#160;!important">&nbsp;</div>
13037 <div style="border : solid;">&nbsp;</div>
13038 !! result
13039 <div style="width:50% !important">&nbsp;</div>
13040 <div style="width:50% !important">&nbsp;</div>
13041 <div style="width:50% !important">&nbsp;</div>
13042 <div style="border&#160;: solid;">&nbsp;</div>
13043
13044 !! end
13045
13046 !! test
13047 HTML5 data attributes
13048 !! input
13049 <span data-foo="bar">Baz</span>
13050 <p data-abc-def_hij="">Quuz</p>
13051 !! result
13052 <p><span data-foo="bar">Baz</span>
13053 </p>
13054 <p data-abc-def_hij="">Quuz</p>
13055
13056 !! end
13057
13058 !! test
13059 percent-encoding and + signs in internal links (Bug 26410)
13060 !! input
13061 [[User:+%]] [[Page+title%]]
13062 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
13063 [[%]] [[+]] [[image:%+abc%39|foo|[[bar]]]]
13064 [[%33%45]] [[%33%45+]]
13065 !! result
13066 <p><a href="/index.php?title=User:%2B%25&amp;action=edit&amp;redlink=1" class="new" title="User:+% (page does not exist)">User:+%</a> <a href="/index.php?title=Page%2Btitle%25&amp;action=edit&amp;redlink=1" class="new" title="Page+title% (page does not exist)">Page+title%</a>
13067 <a href="/index.php?title=%25%2B&amp;action=edit&amp;redlink=1" class="new" title="%+ (page does not exist)">%+</a> <a href="/index.php?title=%25%2B&amp;action=edit&amp;redlink=1" class="new" title="%+ (page does not exist)">%20</a> <a href="/index.php?title=%25%2B&amp;action=edit&amp;redlink=1" class="new" title="%+ (page does not exist)">%+ </a> <a href="/index.php?title=%25%2Br&amp;action=edit&amp;redlink=1" class="new" title="%+r (page does not exist)">%+r</a>
13068 <a href="/index.php?title=%25&amp;action=edit&amp;redlink=1" class="new" title="% (page does not exist)">%</a> <a href="/index.php?title=%2B&amp;action=edit&amp;redlink=1" class="new" title="+ (page does not exist)">+</a> <a href="/index.php?title=Special:Upload&amp;wpDestFile=%25%2Babc9" class="new" title="File:%+abc9">bar</a>
13069 <a href="/index.php?title=3E&amp;action=edit&amp;redlink=1" class="new" title="3E (page does not exist)">3E</a> <a href="/index.php?title=3E%2B&amp;action=edit&amp;redlink=1" class="new" title="3E+ (page does not exist)">3E+</a>
13070 </p>
13071 !! end
13072
13073 !! test
13074 Special characters in embedded file links (bug 27679)
13075 !! input
13076 [[File:Contains & ampersand.jpg]]
13077 [[File:Does not exist.jpg|Title with & ampersand]]
13078 !! result
13079 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Contains_%26_ampersand.jpg" class="new" title="File:Contains &amp; ampersand.jpg">File:Contains &amp; ampersand.jpg</a>
13080 <a href="/index.php?title=Special:Upload&amp;wpDestFile=Does_not_exist.jpg" class="new" title="File:Does not exist.jpg">Title with &amp; ampersand</a>
13081 </p>
13082 !! end
13083
13084
13085 !! test
13086 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
13087 !! input
13088 Text&apos;s been normalized?
13089 !! result
13090 <p>Text&#39;s been normalized?
13091 </p>
13092 !! end
13093
13094 !! test
13095 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
13096 !! input
13097 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
13098 !! result
13099 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
13100 </p>
13101 !! end
13102
13103 !! test
13104 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
13105 !! input
13106 [http://www.example.org/ ideograms]
13107 !! result
13108 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
13109 </p>
13110 !! end
13111
13112 !! test
13113 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
13114 !! input
13115 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
13116 !! result
13117 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
13118 </p>
13119 !! end
13120
13121 !! article
13122 Mediawiki:loop1
13123 !! text
13124 {{Identical|A}}
13125 !! endarticle
13126
13127 !! article
13128 Mediawiki:loop2
13129 !! text
13130 {{Identical|B}}
13131 !! endarticle
13132
13133 !! article
13134 Template:Identical
13135 !! text
13136 {{int:loop1}}
13137 {{int:loop2}}
13138 !! endarticle
13139
13140 !! test
13141 Bug 31098 Template which includes system messages which includes the template
13142 !! input
13143 {{Identical}}
13144 !! result
13145 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
13146 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
13147 </p>
13148 !! end
13149
13150 !! test
13151 Bug31490 Turkish: ucfirst 'blah'
13152 !! options
13153 language=tr
13154 !! input
13155 {{ucfirst:blah}}
13156 !! result
13157 <p>Blah
13158 </p>
13159 !! end
13160
13161 !! test
13162 Bug31490 Turkish: ucfirst 'ix'
13163 !! options
13164 language=tr
13165 !! input
13166 {{ucfirst:ix}}
13167 !! result
13168 <p>İx
13169 </p>
13170 !! end
13171
13172 !! test
13173 Bug31490 Turkish: lcfirst 'BLAH'
13174 !! options
13175 language=tr
13176 !! input
13177 {{lcfirst:BLAH}}
13178 !! result
13179 <p>bLAH
13180 </p>
13181 !! end
13182
13183 !! test
13184 Bug31490 Turkish: ucfırst (with a dotless i)
13185 !! options
13186 language=tr
13187 !! input
13188 {{ucfırst:blah}}
13189 !! result
13190 <p><a href="/index.php?title=%C5%9Eablon:Ucf%C4%B1rst:blah&amp;action=edit&amp;redlink=1" class="new" title="Şablon:Ucfırst:blah (sayfa mevcut değil)">Şablon:Ucfırst:blah</a>
13191 </p>
13192 !! end
13193
13194 !! test
13195 Bug31490 ucfırst (with a dotless i) with English language
13196 !! options
13197 language=en
13198 !! input
13199 {{ucfırst:blah}}
13200 !! result
13201 <p><a href="/index.php?title=Template:Ucf%C4%B1rst:blah&amp;action=edit&amp;redlink=1" class="new" title="Template:Ucfırst:blah (page does not exist)">Template:Ucfırst:blah</a>
13202 </p>
13203 !! end
13204
13205 !! test
13206 Bug 26375: TOC with italics
13207 !! options
13208 title=[[Main Page]]
13209 !! input
13210 __TOC__
13211 == ''Lost'' episodes ==
13212 !! result
13213 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
13214 <ul>
13215 <li class="toclevel-1 tocsection-1"><a href="#Lost_episodes"><span class="tocnumber">1</span> <span class="toctext"><i>Lost</i> episodes</span></a></li>
13216 </ul>
13217 </td></tr></table>
13218 <h2><span class="mw-headline" id="Lost_episodes"><i>Lost</i> episodes</span> <span class="mw-editsection">[<a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: Lost episodes">edit</a>]</span></h2>
13219
13220 !! end
13221
13222 !! test
13223 Bug 26375: TOC with bold
13224 !! options
13225 title=[[Main Page]]
13226 !! input
13227 __TOC__
13228 == '''should be bold''' then normal text ==
13229 !! result
13230 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
13231 <ul>
13232 <li class="toclevel-1 tocsection-1"><a href="#should_be_bold_then_normal_text"><span class="tocnumber">1</span> <span class="toctext"><b>should be bold</b> then normal text</span></a></li>
13233 </ul>
13234 </td></tr></table>
13235 <h2><span class="mw-headline" id="should_be_bold_then_normal_text"><b>should be bold</b> then normal text</span> <span class="mw-editsection">[<a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: should be bold then normal text">edit</a>]</span></h2>
13236
13237 !! end
13238
13239 !! test
13240 Bug 33845: Headings become cursive in TOC when they contain an image
13241 !! options
13242 title=[[Main Page]]
13243 !! input
13244 __TOC__
13245 == Image [[Image:foobar.jpg]] ==
13246 !! result
13247 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
13248 <ul>
13249 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
13250 </ul>
13251 </td></tr></table>
13252 <h2><span class="mw-headline" id="Image">Image <a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></span> <span class="mw-editsection">[<a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: Image">edit</a>]</span></h2>
13253
13254 !! end
13255
13256 !! test
13257 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
13258 !! options
13259 title=[[Main Page]]
13260 !! input
13261 __TOC__
13262 == <blockquote>Quote</blockquote> ==
13263 !! result
13264 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
13265 <ul>
13266 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
13267 </ul>
13268 </td></tr></table>
13269 <h2><span class="mw-headline" id="Quote"><blockquote>Quote</blockquote></span> <span class="mw-editsection">[<a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: Quote">edit</a>]</span></h2>
13270
13271 !! end
13272
13273 !! test
13274 Unclosed tags in TOC
13275 !! options
13276 title=[[Main Page]]
13277 !! input
13278 __TOC__
13279 == Proof: 2 < 3 ==
13280 <small>Hanc marginis exiguitas non caperet.</small>
13281 QED
13282 !! result
13283 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
13284 <ul>
13285 <li class="toclevel-1 tocsection-1"><a href="#Proof:_2_.3C_3"><span class="tocnumber">1</span> <span class="toctext">Proof: 2 &lt; 3</span></a></li>
13286 </ul>
13287 </td></tr></table>
13288 <h2><span class="mw-headline" id="Proof:_2_.3C_3">Proof: 2 &lt; 3</span> <span class="mw-editsection">[<a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: Proof: 2 &lt; 3">edit</a>]</span></h2>
13289 <p><small>Hanc marginis exiguitas non caperet.</small>
13290 QED
13291 </p>
13292 !! end
13293
13294 !! test
13295 Multiple tags in TOC
13296 !! input
13297 __TOC__
13298 == <i>Foo</i> <b>Bar</b> ==
13299
13300 == <i>Foo</i> <blockquote>Bar</blockquote> ==
13301 !! result
13302 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
13303 <ul>
13304 <li class="toclevel-1 tocsection-1"><a href="#Foo_Bar"><span class="tocnumber">1</span> <span class="toctext"><i>Foo</i> <b>Bar</b></span></a></li>
13305 <li class="toclevel-1 tocsection-2"><a href="#Foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext"><i>Foo</i> Bar</span></a></li>
13306 </ul>
13307 </td></tr></table>
13308 <h2><span class="mw-headline" id="Foo_Bar"><i>Foo</i> <b>Bar</b></span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Foo Bar">edit</a>]</span></h2>
13309 <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i> <blockquote>Bar</blockquote></span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Foo Bar">edit</a>]</span></h2>
13310
13311 !! end
13312
13313 !! test
13314 Tags with parameters in TOC
13315 !! input
13316 __TOC__
13317 == <sup class="in-h2">Hello</sup> ==
13318
13319 == <sup class="a > b">Evilbye</sup> ==
13320 !! result
13321 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
13322 <ul>
13323 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
13324 <li class="toclevel-1 tocsection-2"><a href="#b.22.3EEvilbye"><span class="tocnumber">2</span> <span class="toctext"><sup> b"&gt;Evilbye</sup></span></a></li>
13325 </ul>
13326 </td></tr></table>
13327 <h2><span class="mw-headline" id="Hello"><sup class="in-h2">Hello</sup></span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Hello">edit</a>]</span></h2>
13328 <h2><span class="mw-headline" id="b.22.3EEvilbye"><sup> b"&gt;Evilbye</sup></span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: b&quot;>Evilbye">edit</a>]</span></h2>
13329
13330 !! end
13331
13332 !! test
13333 span tags with directionality in TOC
13334 !! input
13335 __TOC__
13336 == <span dir="ltr">C++</span> ==
13337
13338 == <span dir="rtl">זבנג!</span> ==
13339
13340 == <span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span> ==
13341
13342 == <span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span> ==
13343
13344 == <span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span> ==
13345 !! result
13346 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
13347 <ul>
13348 <li class="toclevel-1 tocsection-1"><a href="#C.2B.2B"><span class="tocnumber">1</span> <span class="toctext"><span dir="ltr">C++</span></span></a></li>
13349 <li class="toclevel-1 tocsection-2"><a href="#.D7.96.D7.91.D7.A0.D7.92.21"><span class="tocnumber">2</span> <span class="toctext"><span dir="rtl">זבנג!</span></span></a></li>
13350 <li class="toclevel-1 tocsection-3"><a href="#The_attributes_on_these_span_tags_must_be_deleted_from_the_TOC"><span class="tocnumber">3</span> <span class="toctext"><span>The attributes on these span tags must be deleted from the TOC</span></span></a></li>
13351 <li class="toclevel-1 tocsection-4"><a href="#All_attributes_on_these_span_tags_must_be_deleted_from_the_TOC"><span class="tocnumber">4</span> <span class="toctext"><span>All attributes on these span tags must be deleted from the TOC</span></span></a></li>
13352 <li class="toclevel-1 tocsection-5"><a href="#Attributes_after_dir_on_these_span_tags_must_be_deleted_from_the_TOC"><span class="tocnumber">5</span> <span class="toctext"><span dir="ltr">Attributes after dir on these span tags must be deleted from the TOC</span></span></a></li>
13353 </ul>
13354 </td></tr></table>
13355 <h2><span class="mw-headline" id="C.2B.2B"><span dir="ltr">C++</span></span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: C++">edit</a>]</span></h2>
13356 <h2><span class="mw-headline" id=".D7.96.D7.91.D7.A0.D7.92.21"><span dir="rtl">זבנג!</span></span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: זבנג!">edit</a>]</span></h2>
13357 <h2><span class="mw-headline" id="The_attributes_on_these_span_tags_must_be_deleted_from_the_TOC"><span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span></span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: The attributes on these span tags must be deleted from the TOC">edit</a>]</span></h2>
13358 <h2><span class="mw-headline" id="All_attributes_on_these_span_tags_must_be_deleted_from_the_TOC"><span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span></span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: All attributes on these span tags must be deleted from the TOC">edit</a>]</span></h2>
13359 <h2><span class="mw-headline" id="Attributes_after_dir_on_these_span_tags_must_be_deleted_from_the_TOC"><span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span></span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Attributes after dir on these span tags must be deleted from the TOC">edit</a>]</span></h2>
13360
13361 !! end
13362
13363 !! article
13364 MediaWiki:Bug32057
13365 !! text
13366 == {{int:headline_sample}} ==
13367 !! endarticle
13368
13369 !! test
13370 Bug 32057: Title needed when expanding <h> nodes.
13371 !! options
13372 title=[[Main Page]]
13373 !! input
13374 {{int:Bug32057}}
13375 !! result
13376 <h2><span class="mw-headline" id="Headline_text">Headline text</span> <span class="mw-editsection">[<a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: Headline text">edit</a>]</span></h2>
13377
13378 !! end
13379
13380 !! test
13381 Strip marker in urlencode
13382 !! input
13383 {{urlencode:x<nowiki/>y}}
13384 {{urlencode:x<nowiki/>y|wiki}}
13385 {{urlencode:x<nowiki/>y|path}}
13386 !! result
13387 <p>xy
13388 xy
13389 xy
13390 </p>
13391 !! end
13392
13393 !! test
13394 Strip marker in lc
13395 !! input
13396 {{lc:x<nowiki/>y}}
13397 !! result
13398 <p>xy
13399 </p>
13400 !! end
13401
13402 !! test
13403 Strip marker in uc
13404 !! input
13405 {{uc:x<nowiki/>y}}
13406 !! result
13407 <p>XY
13408 </p>
13409 !! end
13410
13411 !! test
13412 Strip marker in formatNum
13413 !! input
13414 {{formatnum:1<nowiki/>2}}
13415 {{formatnum:1<nowiki/>2|R}}
13416 !! result
13417 <p>12
13418 12
13419 </p>
13420 !! end
13421
13422 !! test
13423 Check noCommafy in formatNum
13424 !! options
13425 language=be-tarask
13426 !! input
13427 {{formatnum:123456.78}}
13428 {{formatnum:123456.78|NOSEP}}
13429 !! result
13430 <p>123 456,78
13431 123456.78
13432 </p>
13433 !! end
13434
13435 !! test
13436 Strip marker in grammar
13437 !! options
13438 language=fi
13439 !! input
13440 {{grammar:elative|foo<nowiki/>bar}}
13441 !! result
13442 <p>foobarista
13443 </p>
13444 !! end
13445
13446 !! test
13447 Strip marker in padleft
13448 !! input
13449 {{padleft:|2|x<nowiki/>y}}
13450 !! result
13451 <p>xy
13452 </p>
13453 !! end
13454
13455 !! test
13456 Strip marker in padright
13457 !! input
13458 {{padright:|2|x<nowiki/>y}}
13459 !! result
13460 <p>xy
13461 </p>
13462 !! end
13463
13464 !! test
13465 Strip marker in anchorencode
13466 !! input
13467 {{anchorencode:x<nowiki/>y}}
13468 !! result
13469 <p>xy
13470 </p>
13471 !! end
13472
13473 !! test
13474 nowiki inside link inside heading (bug 18295)
13475 !! input
13476 ==[[foo|x<nowiki>y</nowiki>z]]==
13477 !! result
13478 <h2><span class="mw-headline" id="xyz"><a href="/index.php?title=Foo&amp;action=edit&amp;redlink=1" class="new" title="Foo (page does not exist)">xyz</a></span> <span class="mw-editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: xyz">edit</a>]</span></h2>
13479
13480 !! end
13481
13482 !! test
13483 new support for bdi element (bug 31817)
13484 !! input
13485 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
13486 !! result
13487 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
13488
13489 !!end
13490
13491 !! test
13492 Ignore pipe between table row attributes
13493 !! input
13494 {|
13495 | quux
13496 |- id=foo | style='color: red'
13497 | bar
13498 |}
13499 !! result
13500 <table>
13501 <tr>
13502 <td> quux
13503 </td></tr>
13504 <tr id="foo" style="color: red">
13505 <td> bar
13506 </td></tr></table>
13507
13508 !! end
13509
13510 !!test
13511 Gallery override link with WikiLink (bug 34852)
13512 !! input
13513 <gallery>
13514 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
13515 </gallery>
13516 !! result
13517 <ul class="gallery">
13518 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13519 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/InterWikiLink"><img alt="galleryalt" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
13520 <div class="gallerytext">
13521 <p>caption
13522 </p>
13523 </div>
13524 </div></li>
13525 </ul>
13526
13527 !! end
13528
13529 !!test
13530 Gallery override link with absolute external link (bug 34852)
13531 !! input
13532 <gallery>
13533 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
13534 </gallery>
13535 !! result
13536 <ul class="gallery">
13537 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13538 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="http://www.example.org"><img alt="galleryalt" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
13539 <div class="gallerytext">
13540 <p>caption
13541 </p>
13542 </div>
13543 </div></li>
13544 </ul>
13545
13546 !! end
13547
13548 !!test
13549 Gallery override link with malicious javascript (bug 34852)
13550 !! input
13551 <gallery>
13552 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
13553 </gallery>
13554 !! result
13555 <ul class="gallery">
13556 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13557 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/%22_onclick%3D%22alert(%27malicious_javascript_code!%27);"><img alt="galleryalt" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
13558 <div class="gallerytext">
13559 <p>caption
13560 </p>
13561 </div>
13562 </div></li>
13563 </ul>
13564
13565 !! end
13566
13567 !!test
13568 Gallery with invalid title as link (bug 43964)
13569 !! input
13570 <gallery>
13571 File:foobar.jpg|link=<
13572 </gallery>
13573 !! result
13574 <ul class="gallery">
13575 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
13576 <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" /></a></div></div>
13577 <div class="gallerytext">
13578 </div>
13579 </div></li>
13580 </ul>
13581
13582 !! end
13583
13584 !!test
13585 Language parser function
13586 !! input
13587 {{#language:ar}}
13588 !! result
13589 <p>العربية
13590 </p>
13591 !! end
13592
13593 !!test
13594 Padleft and padright as substr
13595 !! input
13596 {{padleft:|3|abcde}}
13597 {{padright:|3|abcde}}
13598 !! result
13599 <p>abc
13600 abc
13601 </p>
13602 !! end
13603
13604 !!test
13605 Bug 34939 - Case insensitive link parsing ([HttP://])
13606 !! input
13607 [HttP://MediaWiki.Org/]
13608 !! result
13609 <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
13610 </p>
13611 !! end
13612
13613 !!test
13614 Bug 34939 - Case insensitive link parsing ([HttP:// title])
13615 !! input
13616 [HttP://MediaWiki.Org/ MediaWiki]
13617 !! result
13618 <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
13619 </p>
13620 !! end
13621
13622 !!test
13623 Bug 34939 - Case insensitive link parsing (HttP://)
13624 !! input
13625 HttP://MediaWiki.Org/
13626 !! result
13627 <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
13628 </p>
13629 !! end
13630
13631 ###
13632 ### Parsoids-specific tests
13633 ### Parsoid-PHP parser incompatibilities
13634 ###
13635 !!test
13636 1. SOL-sensitive wikitext tokens as template-args
13637 !!options
13638 parsoid
13639 !!input
13640 {{echo|*a}}
13641 {{echo|#a}}
13642 {{echo|:a}}
13643 !!result
13644 <p>*a
13645 #a
13646 :a
13647 </p>
13648 !!end
13649
13650 #### The following section of tests are primarily to test
13651 #### wikitext escaping capabilities of Parsoid. Given that
13652 #### escaping can be done any number of ways, the wikitext (input)
13653 #### is always adjusted to reflect how Parsoid adds nowiki
13654 #### escape tags.
13655 ####
13656 #### We are marking several tests as parsoid-only since the
13657 #### HTML in the result section is different from what the
13658 #### PHP parser generates for it.
13659
13660
13661 #### --------------- Headings ---------------
13662 #### 0. Unnested
13663 #### 1. Nested inside html <h1>=foo=</h1>
13664 #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
13665 #### 3. Nested inside html with wikitext split by html tags
13666 #### 4. No escape needed
13667 #### 5. Empty headings <h1></h1>
13668 #### 6. Heading chars in SOL context
13669 #### ----------------------------------------
13670 !! test
13671 Headings: 0. Unnested
13672 !! options
13673 parsoid
13674 !! input
13675 <nowiki>=foo=</nowiki>
13676
13677 <nowiki> =foo= </nowiki>
13678 <!--cmt-->
13679 <nowiki>=foo=</nowiki>
13680
13681 =foo''a''<nowiki>=</nowiki>
13682 !! result
13683 <p>=foo=
13684 </p><p> =foo=
13685 </p><p><!--cmt-->=foo=
13686 </p><p>=foo<i>a</i>=
13687 </p>
13688 !!end
13689
13690 !! test
13691 Headings: 1. Nested inside html
13692 !! options
13693 parsoid
13694 !! input
13695 =<nowiki>=foo=</nowiki>=
13696 ==<nowiki>=foo=</nowiki>==
13697 ===<nowiki>=foo=</nowiki>===
13698 ====<nowiki>=foo=</nowiki>====
13699 =====<nowiki>=foo=</nowiki>=====
13700 ======<nowiki>=foo=</nowiki>======
13701 !! result
13702 <h1>=foo=</h1>
13703 <h2>=foo=</h2>
13704 <h3>=foo=</h3>
13705 <h4>=foo=</h4>
13706 <h5>=foo=</h5>
13707 <h6>=foo=</h6>
13708 !!end
13709
13710 !! test
13711 Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
13712 !! options
13713 parsoid
13714 !! input
13715 =foo=
13716 <nowiki>*bar</nowiki>
13717 =foo=
13718 =bar
13719 =foo=
13720 <nowiki>=bar=</nowiki>
13721 !! result
13722 <h1>foo</h1>*bar
13723 <h1>foo</h1>=bar
13724 <h1>foo</h1>=bar=
13725 !!end
13726
13727 !! test
13728 Headings: 3. Nested inside html with wikitext split by html tags
13729 !! options
13730 parsoid
13731 !! input
13732 =='''bold'''<nowiki>foo=</nowiki>=
13733 !! result
13734 <h1>=<b>bold</b>foo=</h1>
13735 !!end
13736
13737 !! test
13738 Headings: 4a. No escaping needed (testing just h1 and h2)
13739 !! options
13740 parsoid
13741 !! input
13742 ==foo=
13743 =foo==
13744 = =foo= =
13745 ==foo= bar=
13746 ===foo==
13747 ==foo===
13748 =''=''foo==
13749 =<nowiki>=</nowiki>=
13750 !! result
13751 <h1>=foo</h1>
13752 <h1>foo=</h1>
13753 <h1> =foo= </h1>
13754 <h1>=foo= bar</h1>
13755 <h2>=foo</h2>
13756 <h2>foo=</h2>
13757 <h1><i>=</i>foo=</h1>
13758 <h1>=</h1>
13759
13760 !!end
13761
13762 !! test
13763 Headings: 4b. No escaping needed (inside p-tags)
13764 !! options
13765 parsoid
13766 !! input
13767 ===
13768 =foo= x
13769 =foo= <s></s>
13770 !! result
13771 <p>===
13772 =foo= x
13773 =foo= <s></s>
13774 </p>
13775 !!end
13776
13777 !! test
13778 Headings: 5. Empty headings
13779 !! options
13780 parsoid
13781 !! input
13782 =<nowiki/>=
13783 ==<nowiki/>==
13784 ===<nowiki/>===
13785 ====<nowiki/>====
13786 =====<nowiki/>=====
13787 ======<nowiki/>======
13788 !! result
13789 <h1></h1>
13790 <h2></h2>
13791 <h3></h3>
13792 <h4></h4>
13793 <h5></h5>
13794 <h6></h6>
13795 !!end
13796
13797 !! test
13798 Headings: 6. Heading chars in SOL context
13799 !! options
13800 parsoid
13801 !! input
13802 <!--cmt--><nowiki>=h1=</nowiki>
13803 <!--cmt--><nowiki> =h1= </nowiki>
13804 !! result
13805 <p><!--cmt-->=h1=
13806 <!--cmt--> =h1=
13807 </p>
13808 !!end
13809
13810 #### --------------- Lists ---------------
13811 #### 0. Outside nests (*foo, etc.)
13812 #### 1. Nested inside html <ul><li>*foo</li></ul>
13813 #### 2. Inside definition lists
13814 #### 3. Only bullets at start should be escaped
13815 #### 4. No escapes needed
13816 #### 5. No unnecessary escapes
13817 #### 6. Escape bullets in SOL position
13818 #### 7. Escape bullets in a multi-line context
13819 #### ----------------------------------------
13820
13821 !! test
13822 Lists: 0. Outside nests
13823 !! input
13824 <nowiki>*foo</nowiki>
13825
13826 <nowiki>#foo</nowiki>
13827 !! result
13828 <p>*foo
13829 </p><p>#foo
13830 </p>
13831 !!end
13832
13833 !! test
13834 Lists: 1. Nested inside html
13835 !! input
13836 *<nowiki>*foo</nowiki>
13837
13838 *<nowiki>#foo</nowiki>
13839
13840 *<nowiki>:foo</nowiki>
13841
13842 *<nowiki>;foo</nowiki>
13843
13844 #<nowiki>*foo</nowiki>
13845
13846 #<nowiki>#foo</nowiki>
13847
13848 #<nowiki>:foo</nowiki>
13849
13850 #<nowiki>;foo</nowiki>
13851 !! result
13852 <ul><li>*foo
13853 </li></ul>
13854 <ul><li>#foo
13855 </li></ul>
13856 <ul><li>:foo
13857 </li></ul>
13858 <ul><li>;foo
13859 </li></ul>
13860 <ol><li>*foo
13861 </li></ol>
13862 <ol><li>#foo
13863 </li></ol>
13864 <ol><li>:foo
13865 </li></ol>
13866 <ol><li>;foo
13867 </li></ol>
13868
13869 !!end
13870
13871 !! test
13872 Lists: 2. Inside definition lists
13873 !! input
13874 ;<nowiki>;foo</nowiki>
13875
13876 ;<nowiki>:foo</nowiki>
13877
13878 ;<nowiki>:foo</nowiki>
13879 :bar
13880
13881 :<nowiki>:foo</nowiki>
13882 !! result
13883 <dl><dt>;foo
13884 </dt></dl>
13885 <dl><dt>:foo
13886 </dt></dl>
13887 <dl><dt>:foo
13888 </dt><dd>bar
13889 </dd></dl>
13890 <dl><dd>:foo
13891 </dd></dl>
13892
13893 !!end
13894
13895 !! test
13896 Lists: 3. Only bullets at start of text should be escaped
13897 !! input
13898 *<nowiki>*foo*bar</nowiki>
13899
13900 *<nowiki>*foo</nowiki>''it''*bar
13901 !! result
13902 <ul><li>*foo*bar
13903 </li></ul>
13904 <ul><li>*foo<i>it</i>*bar
13905 </li></ul>
13906
13907 !!end
13908
13909 !! test
13910 Lists: 4. No escapes needed
13911 !! options
13912 parsoid
13913 !! input
13914 *foo*bar
13915
13916 *''foo''*bar
13917
13918 *[[Foo]]: bar
13919 !! result
13920 <ul><li>foo*bar
13921 </li></ul>
13922 <ul><li><i>foo</i>*bar
13923 </li></ul>
13924 <ul><li><a href="Foo" rel="mw:WikiLink">Foo</a>: bar
13925 </li></ul>
13926 !!end
13927
13928 !! test
13929 Lists: 5. No unnecessary escapes
13930 !! input
13931 * bar <span><nowiki>[[foo]]</nowiki></span>
13932
13933 *=bar <span><nowiki>[[foo]]</nowiki></span>
13934
13935 *[[bar <span><nowiki>[[foo]]</nowiki></span>
13936
13937 *]]bar <span><nowiki>[[foo]]</nowiki></span>
13938
13939 *=bar <span>foo]]</span>=
13940
13941 * <s></s>: a
13942 !! result
13943 <ul><li> bar <span>[[foo]]</span>
13944 </li></ul>
13945 <ul><li>=bar <span>[[foo]]</span>
13946 </li></ul>
13947 <ul><li>[[bar <span>[[foo]]</span>
13948 </li></ul>
13949 <ul><li>]]bar <span>[[foo]]</span>
13950 </li></ul>
13951 <ul><li>=bar <span>foo]]</span>=
13952 </li></ul>
13953 <ul><li> <s></s>: a
13954 </li></ul>
13955
13956 !!end
13957
13958 !! test
13959 Lists: 6. Escape bullets in SOL position
13960 !! options
13961 parsoid
13962 !! input
13963 <!--cmt--><nowiki>*foo</nowiki>
13964 !! result
13965 <p><!--cmt-->*foo
13966 </p>
13967 !!end
13968
13969 !! test
13970 Lists: 7. Escape bullets in a multi-line context
13971 !! input
13972 <nowiki>a
13973 *b</nowiki>
13974 !! result
13975 <p>a
13976 *b
13977 </p>
13978 !!end
13979
13980 #### --------------- HRs ---------------
13981 #### 1. Single line
13982 #### -----------------------------------
13983
13984 !! test
13985 HRs: 1. Single line
13986 !! options
13987 parsoid
13988 !! input
13989 ----<nowiki>----</nowiki>
13990 ----=foo=
13991 ----*foo
13992 !! result
13993 <hr/>----
13994 <hr/>=foo=
13995 <hr/>*foo
13996 !! end
13997
13998 #### --------------- Tables ---------------
13999 #### 1a. Simple example
14000 #### 1b. No escaping needed (!foo)
14001 #### 1c. No escaping needed (|foo)
14002 #### 1d. No escaping needed (|}foo)
14003 ####
14004 #### 2a. Nested in td (<td>foo|bar</td>)
14005 #### 2b. Nested in td (<td>foo||bar</td>)
14006 #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
14007 ####
14008 #### 3a. Nested in th (<th>foo!bar</th>)
14009 #### 3b. Nested in th (<th>foo!!bar</th>)
14010 #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
14011 ####
14012 #### 4a. Escape -
14013 #### 4b. Escape +
14014 #### 4c. No escaping needed
14015 #### --------------------------------------
14016
14017 !! test
14018 Tables: 1a. Simple example
14019 !! input
14020 <nowiki>{|
14021 |}</nowiki>
14022 !! result
14023 <p>{|
14024 |}
14025 </p>
14026 !! end
14027
14028 !! test
14029 Tables: 1b. No escaping needed
14030 !! input
14031 !foo
14032 !! result
14033 <p>!foo
14034 </p>
14035 !! end
14036
14037 !! test
14038 Tables: 1c. No escaping needed
14039 !! input
14040 |foo
14041 !! result
14042 <p>|foo
14043 </p>
14044 !! end
14045
14046 !! test
14047 Tables: 1d. No escaping needed
14048 !! input
14049 |}foo
14050 !! result
14051 <p>|}foo
14052 </p>
14053 !! end
14054
14055 !! test
14056 Tables: 2a. Nested in td
14057 !! options
14058 parsoid
14059 !! input
14060 {|
14061 |<nowiki>foo|bar</nowiki>
14062 |}
14063 !! result
14064 <table>
14065 <tr><td>foo|bar
14066 </td></tr></table>
14067
14068 !! end
14069
14070 !! test
14071 Tables: 2b. Nested in td
14072 !! options
14073 parsoid
14074 !! input
14075 {|
14076 |<nowiki>foo||bar</nowiki>
14077 |''it''<nowiki>foo||bar</nowiki>
14078 |}
14079 !! result
14080 <table>
14081 <tr><td>foo||bar
14082 </td><td><i>it</i>foo||bar
14083 </td></tr></table>
14084
14085 !! end
14086
14087 !! test
14088 Tables: 2c. Nested in td -- no escaping needed
14089 !! options
14090 parsoid
14091 !! input
14092 {|
14093 |foo!!bar
14094 |}
14095 !! result
14096 <table>
14097 <tr><td>foo!!bar
14098 </td></tr></table>
14099
14100 !! end
14101
14102 !! test
14103 Tables: 3a. Nested in th
14104 !! options
14105 parsoid
14106 !! input
14107 {|
14108 !foo!bar
14109 |}
14110 !! result
14111 <table>
14112 <tr><th>foo!bar
14113 </th></tr></table>
14114
14115 !! end
14116
14117 !! test
14118 Tables: 3b. Nested in th
14119 !! options
14120 parsoid
14121 !! input
14122 {|
14123 !<nowiki>foo!!bar</nowiki>
14124 |}
14125 !! result
14126 <table>
14127 <tr><th>foo!!bar
14128 </th></tr></table>
14129
14130 !! end
14131
14132 !! test
14133 Tables: 3c. Nested in th -- no escaping needed
14134 !! options
14135 parsoid
14136 !! input
14137 {|
14138 !<nowiki>foo||bar</nowiki>
14139 |}
14140 !! result
14141 <table>
14142 <tr><th>foo||bar
14143 </th></tr></table>
14144
14145 !! end
14146
14147 !! test
14148 Tables: 4a. Escape -
14149 !! options
14150 parsoid
14151 !! input
14152 {|
14153 |-
14154 !-bar
14155 |-
14156 |<nowiki>-bar</nowiki>
14157 |}
14158 !! result
14159 <table><tbody>
14160 <tr><th>-bar</th></tr>
14161 <tr><td>-bar</td></tr>
14162 </tbody></table>
14163 !! end
14164
14165 !! test
14166 Tables: 4b. Escape +
14167 !! options
14168 parsoid
14169 !! input
14170 {|
14171 |-
14172 !+bar
14173 |-
14174 |<nowiki>+bar</nowiki>
14175 |}
14176 !! result
14177 <table><tbody>
14178 <tr><th>+bar</th></tr>
14179 <tr><td>+bar</td></tr>
14180 </tbody></table>
14181 !! end
14182
14183 !! test
14184 Tables: 4c. No escaping needed
14185 !! options
14186 parsoid
14187 !! input
14188 {|
14189 |-
14190 |foo-bar
14191 |foo+bar
14192 |-
14193 |''foo''-bar
14194 |''foo''+bar
14195 |}
14196 !! result
14197 <table><tbody>
14198 <tr><td>foo-bar</td><td>foo+bar</td></tr>
14199 <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
14200 </tbody></table>
14201 !! end
14202
14203 ### SSS FIXME: Disabled right now because accurate html2wt
14204 ### on this snippet requires data-parsoid flags that we've
14205 ### stripped out of these tests. We should scheme how we
14206 ### we want to handle these kind of tests that require
14207 ### data-parsoid flags for accurate html2wt serialization
14208
14209 !! test
14210 Tables: 4d. No escaping needed
14211 !! options
14212 disabled
14213 !! input
14214 {|
14215 ||+1
14216 ||-2
14217 |}
14218 !! result
14219 <table>
14220 <tr>
14221 <td>+1
14222 </td>
14223 <td>-2
14224 </td></tr></table>
14225
14226 !! end
14227
14228 #### --------------- Links ---------------
14229 #### 1. Quote marks in link text
14230 #### 2. Wikilinks: Escapes needed
14231 #### 3. Wikilinks: No escapes needed
14232 #### 4. Extlinks: Escapes needed
14233 #### 5. Extlinks: No escapes needed
14234 #### --------------------------------------
14235 !! test
14236 Links 1. Quote marks in link text
14237 !! options
14238 parsoid
14239 !! input
14240 [[Foo|<nowiki>Foo''boo''</nowiki>]]
14241 !! result
14242 <a rel="mw:WikiLink" href="Foo">Foo''boo''</a>
14243 !! end
14244
14245 !! test
14246 Links 2. WikiLinks: Escapes needed
14247 !! options
14248 parsoid
14249 !! input
14250 [[Foo|<nowiki>[Foobar]</nowiki>]]
14251 [[Foo|<nowiki>Foobar]</nowiki>]]
14252 [[Foo|x [Foobar] x]]
14253 [[Foo|<nowiki>x [http://google.com g] x</nowiki>]]
14254 [[Foo|<nowiki>[[Bar]]</nowiki>]]
14255 [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
14256 [[Foo|<nowiki>|Bar</nowiki>]]
14257 [[Foo|<nowiki>]]bar</nowiki>]]
14258 [[Foo|<nowiki>[[bar</nowiki>]]
14259 [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
14260 !! result
14261 <a href="Foo" rel="mw:WikiLink">[Foobar]</a>
14262 <a href="Foo" rel="mw:WikiLink">Foobar]</a>
14263 <a href="Foo" rel="mw:WikiLink">x [Foobar] x</a>
14264 <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
14265 <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
14266 <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
14267 <a href="Foo" rel="mw:WikiLink">|Bar</a>
14268 <a href="Foo" rel="mw:WikiLink">]]bar</a>
14269 <a href="Foo" rel="mw:WikiLink">[[bar</a>
14270 <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
14271 !! end
14272
14273 !! test
14274 Links 3. WikiLinks: No escapes needed
14275 !! options
14276 parsoid
14277 !! input
14278 [[Foo|[Foobar]]
14279 [[Foo|foo|bar]]
14280 !! result
14281 <a href="Foo" rel="mw:WikiLink">[Foobar</a>
14282 <a href="Foo" rel="mw:WikiLink">foo|bar</a>
14283 !! end
14284
14285 !! test
14286 Links 4. ExtLinks: Escapes needed
14287 !! options
14288 parsoid
14289 !! input
14290 [http://google.com <nowiki>[google]</nowiki>]
14291 [http://google.com <nowiki>google]</nowiki>]
14292 !! result
14293 <a href="http://google.com" rel="mw:ExtLink">[google]</a>
14294 <a href="http://google.com" rel="mw:ExtLink">google]</a>
14295 !! end
14296
14297 !! test
14298 Links 5. ExtLinks: No escapes needed
14299 !! options
14300 parsoid
14301 !! input
14302 [http://google.com [google]
14303 !! result
14304 <a href="http://google.com" rel="mw:ExtLink">[google</a>
14305 !! end
14306
14307 #### --------------- Quotes ---------------
14308 #### 1. Quotes inside <b> and <i>
14309 #### 2. Link fragments separated by <i> and <b> tags
14310 #### 3. Link fragments inside <i> and <b>
14311 #### --------------------------------------
14312 !! test
14313 1. Quotes inside <b> and <i>
14314 !! input
14315 ''<nowiki>'foo'</nowiki>''
14316 ''<nowiki>''foo''</nowiki>''
14317 ''<nowiki>'''foo'''</nowiki>''
14318 '''<nowiki>'foo'</nowiki>'''
14319 '''<nowiki>''foo''</nowiki>'''
14320 '''<nowiki>'''foo'''</nowiki>'''
14321 '''<nowiki>foo'</nowiki>''<nowiki>bar'</nowiki>''baz'''
14322 !! result
14323 <p><i>'foo'</i>
14324 <i>''foo''</i>
14325 <i>'''foo'''</i>
14326 <b>'foo'</b>
14327 <b>''foo''</b>
14328 <b>'''foo'''</b>
14329 <b>foo'<i>bar'</i>baz</b>
14330 </p>
14331 !! end
14332
14333 !! test
14334 2. Link fragments separated by <i> and <b> tags
14335 !! input
14336 [[''foo''<nowiki>hello]]</nowiki>
14337
14338 [['''foo'''<nowiki>hello]]</nowiki>
14339 !! result
14340 <p>[[<i>foo</i>hello]]
14341 </p><p>[[<b>foo</b>hello]]
14342 </p>
14343 !! end
14344
14345 !! test
14346 2. Link fragments inside <i> and <b>
14347 (FIXME: Escaping one or both of [[ and ]] is also acceptable --
14348 this is one of the shortcomings of this format)
14349 !! input
14350 ''[[foo''<nowiki>]]</nowiki>
14351
14352 '''[[foo'''<nowiki>]]</nowiki>
14353 !! result
14354 <p><i>[[foo</i>]]
14355 </p><p><b>[[foo</b>]]
14356 </p>
14357 !! end
14358
14359 #### --------------- Paragraphs ---------------
14360 #### 1. No unnecessary escapes
14361 #### --------------------------------------
14362
14363 !! test
14364 1. No unnecessary escapes
14365 !! input
14366 bar <span><nowiki>[[foo]]</nowiki></span>
14367
14368 =bar <span><nowiki>[[foo]]</nowiki></span>
14369
14370 [[bar <span><nowiki>[[foo]]</nowiki></span>
14371
14372 ]]bar <span><nowiki>[[foo]]</nowiki></span>
14373
14374 =bar <span>foo]]</span><nowiki>=</nowiki>
14375 !! result
14376 <p>bar <span>[[foo]]</span>
14377 </p><p>=bar <span>[[foo]]</span>
14378 </p><p>[[bar <span>[[foo]]</span>
14379 </p><p>]]bar <span>[[foo]]</span>
14380 </p><p>=bar <span>foo]]</span>=
14381 </p>
14382 !!end
14383
14384 #### --------------- PRE ------------------
14385 #### 1. Leading space in SOL context should be escaped
14386 #### --------------------------------------
14387 !! test
14388 1. Leading space in SOL context should be escaped
14389 !! options
14390 parsoid
14391 !! input
14392 <nowiki> foo</nowiki>
14393 <!--cmt--><nowiki> foo</nowiki>
14394 !! result
14395 <p> foo
14396 <!--cmt--> foo
14397 </p>
14398 !! end
14399
14400 #### --------------- HTML tags ---------------
14401 #### 1. a tags
14402 #### 2. other tags
14403 #### 3. multi-line html tag
14404 #### --------------------------------------
14405 !! test
14406 1. a tags
14407 !! options
14408 parsoid
14409 !! input
14410 <a href="http://google.com">google</a>
14411 !! result
14412 &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
14413 !! end
14414
14415 !! test
14416 2. other tags
14417 !! input
14418 <nowiki><div>foo</div>
14419 <div style="color:red">foo</div></nowiki>
14420 !! result
14421 <p>&lt;div&gt;foo&lt;/div&gt;
14422 &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;
14423 </p>
14424 !! end
14425
14426 !! test
14427 3. multi-line html tag
14428 !! input
14429 <nowiki><div
14430 >foo</div
14431 ></nowiki>
14432 !! result
14433 <p>&lt;div
14434 &gt;foo&lt;/div
14435 &gt;
14436 </p>
14437 !! end
14438
14439 #### --------------- Others ---------------
14440 !! test
14441 Escaping nowikis
14442 !! input
14443 &lt;nowiki&gt;foo&lt;/nowiki&gt;
14444 !! result
14445 <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
14446 </p>
14447 !! end
14448 !! test
14449
14450 Tag-like HTML structures are passed through as text
14451 !! input
14452 <x y>
14453
14454 <x.y>
14455
14456 <x-y>
14457
14458 1>2
14459
14460 x<y
14461
14462 a>b
14463
14464 1<d e>f
14465 !! result
14466 <p>&lt;x y&gt;
14467 </p><p>&lt;x.y&gt;
14468 </p><p>&lt;x-y&gt;
14469 </p><p>1&gt;2
14470 </p><p>x&lt;y
14471 </p><p>a&gt;b
14472 </p><p>1&lt;d e&gt;f
14473 </p>
14474 !! end
14475
14476
14477 # This fails in the PHP parser (see bug 40670,
14478 # https://bugzilla.wikimedia.org/show_bug.cgi?id=40670), so disabled for it.
14479 !! test
14480 Tag names followed by punctuation should not be recognized as tags
14481 !! options
14482 parsoid
14483 !! input
14484 <s.ome> text
14485 !! result
14486 <p>&lt;s.ome&gt text
14487 </p>
14488 !! end
14489
14490 !! test
14491 HTML tag with necessary entities in attributes
14492 !! input
14493 <span title="&amp;amp;">foo</span>
14494 !! result
14495 <p><span title="&amp;amp;">foo</span>
14496 </p>
14497 !! end
14498
14499 !! test
14500 HTML tag with 'unnecessary' entity encoding in attributes
14501 !! input
14502 <span title="&amp;">foo</span>
14503 !! result
14504 <p><span title="&amp;">foo</span>
14505 </p>
14506 !! end
14507
14508 !! test
14509 HTML tag with broken attribute value quoting
14510 !! input
14511 <span title="Hello world>Foo</span>
14512 !! result
14513 <p><span>Foo</span>
14514 </p>
14515 !! end
14516
14517 !! test
14518 Parsoid-only: HTML tag with broken attribute value quoting
14519 !! options
14520 parsoid
14521 !! input
14522 <span title="Hello world>Foo</span>
14523 !! result
14524 <p><span title="Hello world">Foo</span>
14525 </p>
14526 !! end
14527
14528 !! test
14529 Table with broken attribute value quoting
14530 !! input
14531 {|
14532 | title="Hello world|Foo
14533 |}
14534 !! result
14535 <table>
14536 <tr>
14537 <td>Foo
14538 </td></tr></table>
14539
14540 !! end
14541
14542 !! test
14543 Table with broken attribute value quoting on consecutive lines
14544 !! input
14545 {|
14546 | title="Hello world|Foo
14547 | style="color:red|Bar
14548 |}
14549 !! result
14550 <table>
14551 <tr>
14552 <td>Foo
14553 </td>
14554 <td>Bar
14555 </td></tr></table>
14556
14557 !! end
14558
14559 !! test
14560 Parsoid-only: Table with broken attribute value quoting on consecutive lines
14561 !! options
14562 parsoid
14563 !! input
14564 {|
14565 | title="Hello world|Foo
14566 | style="color:red|Bar
14567 |}
14568 !! result
14569 <table>
14570 <tr>
14571 <td title="Hello world">Foo
14572 </td><td style="color: red">Bar
14573 </td></tr></table>
14574
14575 !! end
14576
14577 !! test
14578 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
14579 !! options
14580 parsoid
14581 !! input
14582 {{}}
14583 !! result
14584 {{}}
14585 !! end
14586
14587 !! test
14588 Parsoid-only: Don't wrap broken template tags in <nowiki> on wt2wt (Bug 42353)
14589 !! options
14590 parsoid
14591 !! input
14592 }}{{
14593 !! result
14594 }}{{
14595 !! end
14596
14597 !!test
14598 Accept empty td cell attribute
14599 !!input
14600 {|
14601 | align="center" | foo || |
14602 |}
14603 !!result
14604 <table>
14605 <tr>
14606 <td align="center"> foo </td>
14607 <td>
14608 </td></tr></table>
14609
14610 !!end
14611
14612 !!test
14613 Non-empty attributes in th-cells
14614 !!input
14615 {|
14616 ! Foo !! style="color: red" | Bar
14617 |}
14618 !!result
14619 <table>
14620 <tr>
14621 <th> Foo </th>
14622 <th style="color: red"> Bar
14623 </th></tr></table>
14624
14625 !!end
14626
14627 !!test
14628 Accept empty attributes in th-cells
14629 !!input
14630 {|
14631 !| foo !!| bar
14632 |}
14633 !!result
14634 <table>
14635 <tr>
14636 <th> foo </th>
14637 <th> bar
14638 </th></tr></table>
14639
14640 !!end
14641
14642 !!test
14643 Empty table rows go away
14644 !!input
14645 {|
14646 | Hello
14647 | there
14648 |- class="foo"
14649 |-
14650 |}
14651 !! result
14652 <table>
14653 <tr>
14654 <td> Hello
14655 </td>
14656 <td> there
14657 </td></tr>
14658
14659 </table>
14660
14661 !! end
14662
14663 ###
14664 ### Parsoid-centric tests for testing RTing of inter-element separators
14665 ### Edge cases not tested by existing parser tests and specific to
14666 ### Parsoid-specific serialization strategies.
14667 ###
14668
14669 !!test
14670 RT-ed inter-element separators should be valid separators
14671 !!input
14672 {|
14673 |- [[foo]]
14674 |}
14675 !!result
14676 <table>
14677
14678 </table>
14679
14680 !!end
14681
14682 !!test
14683 Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
14684 (Parsoid-only since PHP parser relies on Tidy for correct output)
14685 !!options
14686 parsoid
14687 !!input
14688 {|
14689 |<small>foo
14690 bar
14691 |}
14692
14693 {|
14694 |<small>foo<small>
14695 |}
14696 !!result
14697 !!end
14698
14699 !!test
14700 Empty TD followed by TD with tpl-generated attribute
14701 !!input
14702 {|
14703 |-
14704 |
14705 |{{echo|style='color:red'}}|foo
14706 |}
14707 !!result
14708 <table>
14709
14710 <tr>
14711 <td>
14712 </td>
14713 <td>foo
14714 </td></tr></table>
14715
14716 !!end
14717
14718 !!test
14719 Indented table with an empty td
14720 !!input
14721 {|
14722 |-
14723 |
14724 |foo
14725 |}
14726 !!result
14727 <table>
14728
14729 <tr>
14730 <td>
14731 </td>
14732 <td>foo
14733 </td></tr></table>
14734
14735 !!end
14736
14737 !!test
14738 Empty TR followed by a template-generated TR
14739 (Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext)
14740 !!options
14741 parsoid
14742 !!input
14743 {|
14744 |-
14745 {{echo|<tr><td>foo</td></tr>}}
14746 |}
14747 !!result
14748 <table>
14749 <tbody>
14750 <tr>
14751 </tr>
14752 <tr>
14753 <td>foo</td></tr></tbody></table>
14754 !!end
14755
14756 ## PHP and parsoid output differ for this, and since this is primarily
14757 ## for testing Parsoid's serializer, marking this Parsoid only
14758 !!test
14759 Empty TR followed by mixed-ws-comment line should RT correctly
14760 !!options
14761 parsoid
14762 !!input
14763 {|
14764 |-
14765 <!--c-->
14766 |-
14767 <!--c--> <!--d-->
14768 |}
14769 !!result
14770 <table>
14771 <tbody>
14772 <tr>
14773 <td> <!--c--></td></tr>
14774 <tr>
14775 <td><!--c--> <!--d--></td></tr>
14776 </table>
14777
14778 !!end
14779
14780 !!test
14781 Multi-line image caption generated by templates with/without trailing newlines
14782 !!options
14783 parsoid
14784 !!input
14785 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
14786 [[File:foo.jpg|thumb|300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
14787 !!result
14788 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/index.php?title=Special:Upload&amp;wpDestFile=Foo.jpg" class="new" title="File:Foo.jpg">File:Foo.jpg</a> <div class="thumbcaption">foo\nA\nB\nC</div></div></div>
14789 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/index.php?title=Special:Upload&amp;wpDestFile=Foo.jpg" class="new" title="File:Foo.jpg">File:Foo.jpg</a> <div class="thumbcaption">foo\nA\nB\nC\n\n</div></div></div>
14790
14791 !!end
14792
14793 ## PHP emits broken html for this, and since this is primarily
14794 ## a Parsoid serializer test, marking this Parsoid only
14795 !!test
14796 Improperly nested inline or quotes tags with whitespace in between
14797 !!options
14798 parsoid
14799 !!input
14800 <span> <s>x</span> </s>
14801 ''' ''x''' ''
14802 !!result
14803 <p><span> <s>x</s></span><s> </s>
14804 <b> <i>x</i></b><i> </i></span>
14805 </p>
14806 !!end
14807
14808 TODO:
14809 more images
14810 more tables
14811 character entities
14812 and much more
14813 Try for 100% code coverage